Skip to content

Commit

Permalink
Get the 11ty site building
Browse files Browse the repository at this point in the history
This commit fixes or works around all the errors that prevent the 11ty site from building at all.

This commit:
- Fixes all date metadata in blog posts, to conform to YAML date formats
- Implements placeholder filters (usually returning the input or a TODO message) so there are no missing filter errors.
- Sets sitewide layout path so we can remove `layouts/` from all the layout metadata.
- Moves some assets around to link them correctly
- Updates filter parameters to have quotes around strings, instead of Jekyll's bare params
- Deletes unpublished joke authors

The site is not building *correctly* or outputting the correct pages/content.
  • Loading branch information
beechnut committed May 30, 2024
1 parent 64acbb3 commit d202697
Show file tree
Hide file tree
Showing 130 changed files with 277 additions and 735 deletions.
31 changes: 30 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@ const markdownIt = require('markdown-it');
const markdownItAttrs = require('markdown-it-attrs');
const markdownItAnchor = require('markdown-it-anchor');
const markdownItFootnote = require('markdown-it-footnote');
const { readableDate, htmlDateString, head, min, filterTagList } = require("./config/filters");
const { readableDate
, htmlDateString
, head
, min
, filterTagList
, embed
, team_photo
, team_link
, find_collection
, markdownify
, weighted_sort
, in_groups
, oembed
, relative_url } = require("./config/filters");
const { headingLinks } = require("./config/headingLinks");
const { contrastRatio, humanReadableContrastRatio } = require("./config/wcagColorContrast");
const privateLinks = require ('./config/privateLinksList.js');
Expand Down Expand Up @@ -77,6 +90,21 @@ module.exports = function (config) {
config.addFilter('head', head); // Get the first `n` elements of a collection.
config.addFilter('min', min); // Return the smallest number argument
config.addFilter('filterTagList', filterTagList);
// Add an iframe / embedded content
config.addFilter('embed', embed);
// Add a photo for an 18F team member
config.addFilter('team_photo', team_photo);
// Add a link to an 18F team member's author page
config.addFilter('team_link', team_link);
config.addFilter('find_collection', find_collection);
config.addFilter('weighted_sort', weighted_sort);
config.addFilter('in_groups', in_groups);
config.addShortcode('oembed', oembed);
config.addFilter('relative_url', relative_url);

// FIXME (see other FIXME)
config.addFilter('markdownify', markdownify);

// Color contrast checkers for the color matrix in the Brand guide
config.addFilter('contrastRatio', contrastRatio);
config.addFilter('humanReadableContrastRatio', humanReadableContrastRatio);
Expand Down Expand Up @@ -335,6 +363,7 @@ module.exports = function (config) {
dir: {
input: '.',
includes: '_includes',
layouts: '_includes/layouts',
data: '_data',
output: '_site',
},
Expand Down
1 change: 1 addition & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ README.md
.github
config
docs
spec
8 changes: 4 additions & 4 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/page
layout: page
permalink: /404.html
---

Expand All @@ -10,9 +10,9 @@ <h1>404: Page not found</h1>
<p>
Visit our homepage for helpful tools and resources, or contact us and we’ll point you in the right direction.
</p>
<a href="https://18f.gsa.gov/guides" class="usa-button">
<a href="https://18f.gsa.gov/guides" class="usa-button">
Visit homepage
</a>
<a href="https://18f.gsa.gov/contact" class="usa-button usa-button--outline">
Contact us
<a href="https://18f.gsa.gov/contact" class="usa-button usa-button--outline">
Contact us
</a>
13 changes: 13 additions & 0 deletions _data/assetPaths.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"admi.js": "/assets/_common/js/admin.js",
"ap.js": "/assets/_common/js/app.js",
"inde.html": "/assets/presentations/presentation-README/index.html",
"admin.js": "/assets/js/admin-3AAZDPS4.js",
"admin.map": "/assets/js/admin-3AAZDPS4.js.map",
"app.js": "/assets/js/app-VJ5WPKYD.js",
"app.map": "/assets/js/app-VJ5WPKYD.js.map",
"external.js": "/assets/js/external-links.js",
"uswds.js": "/assets/js/uswds-init.js",
"styles.css": "/assets/styles/styles-YNYM6ERT.css",
"styles.map": "/assets/styles/styles-YNYM6ERT.css.map"
}
6 changes: 3 additions & 3 deletions _includes/feature-image.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% assign include_image = include.image | default: page.image %}
{% assign include_image_alt = include.image | default: page.image_alt | default "" %}
{% assign include_image_alt = include.image | default: page.image_alt | default: "" %}
{% assign include_figcaption = include.image_figcaption | default: page.image_figcaption %}

{% unless page.hero == false %}
{% if page.hero %}
<figure class="post-feature_image" role="img" title="{{ include_image_alt }}" style="background-image: url('{{ site.baseurl }}{{ include_image }}')">
{% if include_figcaption %}
<figcaption>{{- include_figcaption -}}</figcaption>
{% endif %}
</figure>
{% endunless %}
{% endif %}
2 changes: 1 addition & 1 deletion _includes/layouts/data.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/default
layout: default
---

{% comment %}
Expand Down
14 changes: 7 additions & 7 deletions _includes/layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: 'en-US' }}">
<head>
{% include meta.html %}
{% include styles.html %}
{% include "meta.html" %}
{% include "styles.html" %}
{% if site.google_analytics_ua or site.dap_agency %}
{% include analytics.html %}
{% include "analytics.html" %}
{% endif %}
</head>
<body class="{{ layout.class }} {{ page.class }} {% if site.site_width %}site-{{ site.site_width }}{% endif %}">

{% include skipnav.html %}
{% include header.html %}
{% include "skipnav.html" %}
{% include "header.html" %}

{% if page.tagline and page.intro %}
<section class="grid-container usa-section">
Expand All @@ -37,9 +37,9 @@ <h2 class="font-heading-xl margin-top-0 tablet:margin-bottom-0">{{ page.tagline
</main>
{% endif %}

{% include footer.html %}
{% include "footer.html" %}

{% include scripts.html %}
{% include "scripts.html" %}

</body>
</html>
14 changes: 7 additions & 7 deletions _includes/layouts/guides.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@
{% assign page_title = page.subnav_title | default: page.title %}

{% if page.breadcrumb %}
{% include breadcrumb.html
{% include "breadcrumb.html"
page_title=page_title
background_class='bg-base-lightest'
%}
{% endif %}

<section class="usa-section section-padding-sm">
<div class="grid-container">
<div class="grid-container">
<h1> {{ page.title }} </h1>
{% if page.lead %}
{% if page.lead %}
<p class="font-sans-xl line-height-sans-3"> {{ page.lead }} </p>
{% endif %}
{% if page.image %}
<img src="{{ site.baseurl }}{{ page.image }}"
alt="{{ page.image_alt_text }}"
<img src="{{ site.baseurl }}{{ page.image }}"
alt="{{ page.image_alt_text }}"
class="margin-top-4"
>
{% endif %}
</div>
</section>
</section>

{{ content }}

{% if page.banner_cta %}
{% include banner-cta.html %}
{% include "banner-cta.html" %}
{% endif %}

2 changes: 1 addition & 1 deletion _includes/layouts/page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/base
layout: base
---

{% comment %}
Expand Down
22 changes: 11 additions & 11 deletions _includes/layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

{% if page.image %}
{% include feature-image.html %}
{% include "feature-image.html" %}
{% endif %}

<article id="main-content" class="post-article margin-top-6" itemscope itemtype="http://schema.org/BlogPosting">
Expand All @@ -13,12 +13,12 @@
<header>
<h1 itemprop="name headline">{{ page.title }}</h1>
<p class="margin-top-3 margin-bottom-0">
{% include post-author.html context="page" %}
{% include "post-author.html" context="page" %}
</p>
<p class="margin-top-1">
Published on <time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%B %-d, %Y" }}</time>
Published on <time datetime="{{ page.date }}" itemprop="datePublished">{{ page.date | date: "%B %-d, %Y" }}</time>
</p>
{% include post-tags.html post_tags=page.tags %}
{% include "post-tags.html" post_tags=page.tags %}
</header>
</div>
</div>
Expand All @@ -33,8 +33,8 @@ <h1 itemprop="name headline">{{ page.title }}</h1>
{{ content }}
</div>
</div>
<aside class="tablet:grid-offset-1 tablet:grid-col-4">
{% include social-media.html %}
<aside class="tablet:grid-offset-1 tablet:grid-col-4">
{% include "social-media.html" %}
</aside>
</div>
</div>
Expand All @@ -48,7 +48,7 @@ <h1 itemprop="name headline">{{ page.title }}</h1>
<div class="grid-col-6">
{% if page.previous %}
<a href="{{ site.baseurl }}{{ page.previous.url }}"
class="text-no-underline post-pagination__link"
class="text-no-underline post-pagination__link"
>
<h2 class="post-pagination__heading">
{% include svg/icons/arrow-left.svg %}
Expand All @@ -61,7 +61,7 @@ <h2 class="post-pagination__heading">
<div class="grid-col-6 text-right">
{% if page.next %}
<a href="{{ site.baseurl }}{{ page.next.url }}"
class="text-no-underline post-pagination__link"
class="text-no-underline post-pagination__link"
>
<h2 class="post-pagination__heading">
Next Post
Expand All @@ -77,10 +77,10 @@ <h2 class="post-pagination__heading">
</section>
{% endif %}

<section class="margin-top-3 margin-bottom-6">
<section class="margin-top-3 margin-bottom-6">
<div class="grid-container">
{% include featured-posts.html
related_posts=page.related_posts
{% include "featured-posts.html"
related_posts=page.related_posts
show_excerpt="true"
%}
</div>
Expand Down
12 changes: 6 additions & 6 deletions _includes/layouts/primary.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
{% assign page_title = page.subnav_title | default: page.title %}

{% if page.breadcrumb == true %}
{% include breadcrumb.html
{% include "breadcrumb.html"
page_title=page_title
background_class='bg-base-lightest'
%}
{% endif %}

<section class="usa-section section-padding-sm">
<div class="grid-container">
<div class="grid-container">
<h1> {{ page.title }} </h1>
{% if page.lead %}
{% if page.lead %}
<p class="font-sans-xl line-height-sans-3"> {{ page.lead }} </p>
{% endif %}
{% if page.image %}
<img src="{{ site.baseurl }}{{ page.image }}"
alt="{{ page.image_alt_text }}"
<img src="{{ site.baseurl }}{{ page.image }}"
alt="{{ page.image_alt_text }}"
class="margin-top-4"
>
{% endif %}
Expand All @@ -31,6 +31,6 @@ <h1> {{ page.title }} </h1>
{{ content }}

{% if page.banner_cta %}
{% include banner-cta.html %}
{% include "banner-cta.html" %}
{% endif %}

2 changes: 1 addition & 1 deletion _includes/layouts/project-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h2> Related blog posts </h2>
</div>
{% endif %}
</div>
{% include featured-posts.html
{% include "featured-posts.html"
related_posts=matching_posts
max_num_posts=3
show_excerpt=true
Expand Down
14 changes: 7 additions & 7 deletions _includes/layouts/styled-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: primary
---
<section class="usa-section section-padding-top-0">
<div class="grid-container">
<div class="grid-container">
{% if page.title_rule %}
<hr class="hr-1-dark margin-top-0 margin-bottom-8">
{% endif %}
Expand All @@ -12,14 +12,14 @@
{{ content }}
</div>
<aside class="tablet:grid-offset-1 tablet:grid-col-4 margin-bottom-2">
{%- if page.subnav_items %}
{% include subnav.html subnav_items=page.subnav_items %}
{%- if page.subnav_items %}
{% include "subnav.html" subnav_items=page.subnav_items %}
{% endif %}
{%- if page.side_cta -%}
{% include side-cta.html %}
{%- if page.side_cta -%}
{% include "side-cta.html" %}
{% endif -%}
{%- if page.social_media -%}
{% include social-media.html %}
{%- if page.social_media -%}
{% include "social-media.html" %}
{%- endif -%}
</aside>
{%- else -%}
Expand Down
2 changes: 1 addition & 1 deletion _includes/layouts/styleguide.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{% assign sidenav = layout.sidenav %}
{% if sidenav %}
<div class="usa-layout-docs__sidenav desktop:grid-col-3{% if page.sticky_sidenav %} usa-sticky-sidenav{% endif %}">
{% include sidenav.html links=sidenav %}
{% include "sidenav.html" links=sidenav %}
</div>
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion _includes/layouts/wide.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/base
layout: base
---

{% comment %}
Expand Down
5 changes: 4 additions & 1 deletion _includes/post-author.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
{% if include.context == 'page' and page.authors %}
{% assign authors = page.authors %}
{% elsif include.context == 'post' and post.authors %}
{% assign authors = post.authors | to_yaml %}
{% comment %}
TODO: Removed to_yaml filter from this assignment. Does this break anything?
{% endcomment %}
{% assign authors = post.authors %}
{% endif %}
By
{% for author in authors %}
Expand Down
6 changes: 3 additions & 3 deletions _includes/post-previews.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
<li class="border-bottom-1px border-base-lighter padding-y-6">
<h2>
<a href="{{ post.url | prepend: site.baseurl }}"
class="post-link text-no-underline"
class="post-link text-no-underline"
>
{{ post.title }}
</a>
</h2>
{% unless include.limit_metadata %}
<p>
{% include post-author.html context='post' %} on
{% include "post-author.html" context='post' %} on
<span class="post-date">{{ post.date | date: "%B %-d, %Y" }}</span>
</p>
{% endunless %}
<p>{{ post.excerpt }}</p>
{% unless include.limit_metadata %}
{% include post-tags.html post_tags=post.tags %}
{% include "post-tags.html" post_tags=post.tags %}
{% endunless %}
</li>
{% endfor %}
Expand Down
Loading

0 comments on commit d202697

Please sign in to comment.