Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor data #3865

Merged
merged 18 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions .about.yml

This file was deleted.

34 changes: 11 additions & 23 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ const { readableDate
, embed
, teamPhoto
, teamLink
, findCollection
, markdownify
, weightedSort
, inGroups
, oembed
, asRelativeUrl
, matchPosts } = require('./config/filters');
const { postsCollection, servicesCollection, tagsCollection } = require('./config/collections');
const { headingLinks } = require('./config/headingLinks');
const { contrastRatio, humanReadableContrastRatio } = require('./config/wcagColorContrast');
const privateLinks = require ('./config/privateLinksList');
Expand All @@ -33,7 +32,7 @@ const { imageShortcode, imageWithClassShortcode } = require('./config');

const siteData = yaml.load(fs.readFileSync('./_data/site.yaml', 'utf8'));

module.exports = function (config) {
module.exports = function (config) { /* eslint-disable-line func-names */
// Set pathPrefix for site
let pathPrefix = '/';

Expand All @@ -49,13 +48,13 @@ module.exports = function (config) {
config.addPassthroughCopy({'./node_modules/@uswds/uswds/dist/js/uswds-init.js': 'assets/js/uswds-init.js'});

// Specific scripts to guides
config.addPassthroughCopy('./assets/_common/js/*');
config.addPassthroughCopy('./assets/common/js/*');
config.addPassthroughCopy('./assets/**/js/*');

// @TODO This is one place where the _site/img folder gets produced
// Let's find a way to keep everything in assets
config.addPassthroughCopy({'./assets/_common/_img/favicons/favicon.ico': './favicon.ico' });
config.addPassthroughCopy({'./assets/_common/_img/favicons': './img/favicons' });
config.addPassthroughCopy({'./assets/common/img/favicons/favicon.ico': './favicon.ico' });
config.addPassthroughCopy({'./assets/common/img/favicons': './img/favicons' });

config.addPassthroughCopy({'content/robots.txt': '/robots.txt' });
config.addPassthroughCopy('google16a62a069d0c4fa4.html');
Expand Down Expand Up @@ -102,9 +101,7 @@ module.exports = function (config) {
config.addFilter('team_photo', teamPhoto);
// Add a link to an 18F team member's author page
config.addFilter('team_link', teamLink);
config.addFilter('find_collection', findCollection);
config.addFilter('weighted_sort', weightedSort);
config.addFilter('in_groups', inGroups);
config.addShortcode('oembed', oembed);
config.addFilter('relative_url', asRelativeUrl);
config.addFilter('match_posts', matchPosts);
Expand Down Expand Up @@ -143,18 +140,9 @@ module.exports = function (config) {
// TODO: Not sure this is returning exactly the right string, re: datetimes
config.addFilter('date_to_xmlschema', (date) => dateObject(date).toISOString());

// Create an array of all tags
config.addCollection('tagList', (collection) => {
const tagSet = new Set();
collection.getAll().forEach((item) => {
(item.data.tags || []).forEach((tag) => tagSet.add(tag));
});

return filterTagList([...tagSet]);
});

config.addCollection('post', (collection) => collection.getFilteredByGlob('content/posts/*.md'));
config.addCollection('service', (collection) => collection.getFilteredByGlob('content/pages/projects/services/*.md'));
config.addCollection('posts', postsCollection);
config.addCollection('services', servicesCollection);
config.addCollection('tags', tagsCollection);

// Customize Markdown library and settings
const markdownLibrary = markdownIt({
Expand All @@ -177,7 +165,7 @@ module.exports = function (config) {
// https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md
// Token methods: https://github.com/markdown-it/markdown-it/blob/master/lib/token.js#L125
const openDefaultRender = markdownLibrary.renderer.rules.link_open ||
function(tokens, idx, options, env, self) {
function(tokens, idx, options, env, self) { /* eslint-disable-line func-names */
return self.renderToken(tokens, idx, options);
};

Expand Down Expand Up @@ -213,7 +201,7 @@ module.exports = function (config) {
};

const defaultHtmlBlockRender = markdownLibrary.renderer.rules.html_block ||
function(tokens, idx, options, env, self) {
function(tokens, idx, options, env, self) { /* eslint-disable-line func-names */
return self.renderToken(tokens, idx, options);
};

Expand Down Expand Up @@ -260,7 +248,7 @@ module.exports = function (config) {

// Also need to add icon links to any html style links
const inlineHTMLDefaultRender = markdownLibrary.renderer.rules.html_inline ||
function(tokens, idx, options, env, self) {
function(tokens, idx, options, env, self) { /* eslint-disable-line func-names */
return self.renderToken(tokens, idx, options);
};

Expand Down
18 changes: 0 additions & 18 deletions 404.html

This file was deleted.

Loading
Loading