Skip to content

Commit

Permalink
Organize and render all pages
Browse files Browse the repository at this point in the history
This commit:
- Moves all pages to non-underscored folders within content/
- Updates config and marks some suspected guides-specific config for later assessment/removal
- Gets author pages rendering
- Fixes the robots.txt and Google verification pages
  • Loading branch information
beechnut committed May 31, 2024
1 parent 1d50840 commit b41028f
Show file tree
Hide file tree
Showing 377 changed files with 43 additions and 40 deletions.
35 changes: 21 additions & 14 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const { readableDate
, weighted_sort
, in_groups
, oembed
, relative_url } = require("./config/filters");
, relative_url
, match_posts } = require("./config/filters");
const { headingLinks } = require("./config/headingLinks");
const { contrastRatio, humanReadableContrastRatio } = require("./config/wcagColorContrast");
const privateLinks = require ('./config/privateLinksList.js');
Expand Down Expand Up @@ -47,15 +48,13 @@ module.exports = function (config) {
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' });

// Set download paths
// Place files for download in assets/{guide}/dist/{filename.ext}
config.addPassthroughCopy("./assets/**/dist/*");

// methods pdfs
config.addPassthroughCopy({ "./content/methods/assets/downloads/": "./methods/assets/downloads/" });
config.addPassthroughCopy({'content/robots.txt': '/robots.txt' });
config.addPassthroughCopy({'content/google16a62a069d0c4fa4.html': '/google16a62a069d0c4fa4.html' });

// Add plugins
config.addPlugin(pluginRss);
Expand Down Expand Up @@ -101,6 +100,7 @@ module.exports = function (config) {
config.addFilter('in_groups', in_groups);
config.addShortcode('oembed', oembed);
config.addFilter('relative_url', relative_url);
config.addFilter('match_posts', match_posts);

// FIXME (see other FIXME)
config.addFilter('markdownify', markdownify);
Expand All @@ -123,17 +123,23 @@ module.exports = function (config) {
return value.charAt(0).toUpperCase() + value.slice(1);
});

// Converts strings or dates to date objects
const dateObject = ((date) => {
switch(typeof date) {
case "object": return date;
case "string": return new Date(date)
}
})

// Generates the "yyyy/mm/dd" part of permalinks for blog posts
// @example date is Jan 1, 2020
// returns "2020/01/01"
config.addFilter("toDatePath", (date) => {
const dateObject = ((date) => {
switch(typeof date) {
case "object": return date;
case "string": return new Date(date)
}
})(date);
return dateObject.toISOString().split('T')[0].split('-').join('/')
return dateObject(date).toISOString().split('T')[0].split('-').join('/')
});

config.addFilter("toISOString", (date) => {
return dateObject(date).toISOString()
});

// Create an array of all tags
Expand All @@ -146,6 +152,7 @@ module.exports = function (config) {
return filterTagList([...tagSet]);
});

// TODO probably remove
config.addCollection('methods', (collectionApi) => {
/* sort all methods in alpha order */
return collectionApi.getFilteredByTag("methods").sort((a, b) => {
Expand Down
13 changes: 8 additions & 5 deletions _data/site.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
title: 18F Guides
title: "18F: Digital service delivery"
description: >- # this means to ignore newlines
A central resources for all 18F guides and methods
18F builds effective, user-centric digital services focused on the
interaction between government and the people and businesses
it serves.
host: https://guides.18f.gov
host: https://18f.gsa.gov

# Twitter handle. Only the handle, not the URL.
twitter: 18F

dap:
agency: GSA
subagency: TTS
subagency: TTS,18F

ga:
ua: G-94QF2Z1S0G
ua: 'G-HBYXWFP794'

# Search.gov configuration
#
Expand All @@ -26,6 +28,7 @@ searchgov:
endpoint: https://search.usa.gov

# Replace this with your search.gov account.
# TODO rename?
affiliate: 18f-guides

# Replace this with your access key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<section class="usa-section section-padding-sm">
<div class="grid-container">
<header>
{% if page.full_name %}
<h1>Blog posts by {{ page.full_name }}{% if page.alumni %} <span>(18F alumni)</span>{% endif %}{% if page.guest %} <span>(guest author)</span>{% endif %}:</h1>
{% if full_name %}
<h1>Blog posts by {{ full_name }}{% if alumni %} <span>(18F alumni)</span>{% endif %}{% if guest %} <span>(guest author)</span>{% endif %}:</h1>
{% endif %}
</header>
</div>
Expand All @@ -20,9 +20,9 @@ <h1>Blog posts by {{ page.full_name }}{% if page.alumni %} <span>(18F alumni)</s
<div class="grid-container">
<hr class="hr-1-dark margin-y-0">
{%
include post-previews.html
include "post-previews.html"
posts=matching_posts
tags=page.tags
tags=tags
%}
</div>
</section>
2 changes: 1 addition & 1 deletion _includes/layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 itemprop="name headline">{{ page.title }}</h1>
{% include "post-author.html" context="page" %}
</p>
<p class="margin-top-1">
Published on <time datetime="{{ page.date }}" itemprop="datePublished">{{ page.date | date: "%B %-d, %Y" }}</time>
Published on <time datetime="{{ page.date | toISOString }}" itemprop="datePublished">{{ page.date | date: "%B %-d, %Y" }}</time>
</p>
{% include "post-tags.html" post_tags=page.tags %}
</header>
Expand Down
4 changes: 2 additions & 2 deletions _includes/layouts/tag-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Layout for posts by tag
{% endcomment %}
<section class="usa-section section-padding-sm">
<div class="grid-container">
<div class="grid-container">
<a href="{{ site.baseurl }}/blog/" class="display-flex flex-align-center"><span class="usa-sr-only">Back to</span>{%- include svg/icons/arrow-left.svg -%}<span class="margin-left-05">18F Blog </span> </a>
{% assign numberof = page.posts | size %}
<h1 class="margin-top-2">{{ numberof }} {% if numberof == 1 %}post{% else %}posts{% endif %} tagged with "{{ page.title }}" </h1>
Expand All @@ -16,7 +16,7 @@ <h1 class="margin-top-2">{{ numberof }} {% if numberof == 1 %}post{% else %}post
<div class="grid-container">
<hr class="hr-1-dark margin-y-0">
{%
include post-previews.html
include "post-previews.html"
posts=page.posts
tags=page.tags
%}
Expand Down
2 changes: 2 additions & 0 deletions config/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const weighted_sort = (array, weight_name, sort_name) => { return array }
const in_groups = (array, groups) => { return array }
const oembed = (url) => { return `TODO EMBED ${url}` }
const relative_url = (url) => { return url }
const match_posts = (page, property="tags") => { return [] }

// FIXME
// The markdownify filter in this site is mostly a smell,
Expand All @@ -63,4 +64,5 @@ module.exports = {
in_groups,
oembed,
relative_url,
match_posts,
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions content/authors/authors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"layout": "author",
"permalink": "/author/{{ name | slugify }}/"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b41028f

Please sign in to comment.