Skip to content

Commit 0c4a622

Browse files
committed
Initial setup with cloud.gov pages
1 parent 2449ede commit 0c4a622

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+24576
-0
lines changed

.eleventy.js

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
const { DateTime } = require('luxon');
2+
const fs = require('fs');
3+
const pluginRss = require('@11ty/eleventy-plugin-rss');
4+
const pluginNavigation = require('@11ty/eleventy-navigation');
5+
const markdownIt = require('markdown-it');
6+
const markdownItAnchor = require('markdown-it-anchor');
7+
const yaml = require("js-yaml");
8+
const svgSprite = require("eleventy-plugin-svg-sprite");
9+
const { imageShortcode, imageWithClassShortcode } = require('./config');
10+
11+
module.exports = function (config) {
12+
// Set pathPrefix for site
13+
let pathPrefix = '/';
14+
15+
// Copy the `admin` folders to the output
16+
config.addPassthroughCopy('admin');
17+
18+
// Copy USWDS init JS so we can load it in HEAD to prevent banner flashing
19+
config.addPassthroughCopy({'./node_modules/@uswds/uswds/dist/js/uswds-init.js': 'assets/js/uswds-init.js'});
20+
21+
// Add plugins
22+
config.addPlugin(pluginRss);
23+
config.addPlugin(pluginNavigation);
24+
25+
//// SVG Sprite Plugin for USWDS USWDS icons
26+
config.addPlugin(svgSprite, {
27+
path: "./node_modules/@uswds/uswds/dist/img/uswds-icons",
28+
svgSpriteShortcode: 'uswds_icons_sprite',
29+
svgShortcode: 'uswds_icons'
30+
});
31+
32+
//// SVG Sprite Plugin for USWDS USA icons
33+
config.addPlugin(svgSprite, {
34+
path: "./node_modules/@uswds/uswds/dist/img/usa-icons",
35+
svgSpriteShortcode: 'usa_icons_sprite',
36+
svgShortcode: 'usa_icons'
37+
});
38+
39+
// Allow yaml to be used in the _data dir
40+
config.addDataExtension("yaml", contents => yaml.load(contents));
41+
42+
config.addFilter('readableDate', (dateObj) => {
43+
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat(
44+
'dd LLL yyyy'
45+
);
46+
});
47+
48+
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
49+
config.addFilter('htmlDateString', (dateObj) => {
50+
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy-LL-dd');
51+
});
52+
53+
// Get the first `n` elements of a collection.
54+
config.addFilter('head', (array, n) => {
55+
if (!Array.isArray(array) || array.length === 0) {
56+
return [];
57+
}
58+
if (n < 0) {
59+
return array.slice(n);
60+
}
61+
62+
return array.slice(0, n);
63+
});
64+
65+
// Return the smallest number argument
66+
config.addFilter('min', (...numbers) => {
67+
return Math.min.apply(null, numbers);
68+
});
69+
70+
function filterTagList(tags) {
71+
return (tags || []).filter(
72+
(tag) => ['all', 'nav', 'post', 'posts'].indexOf(tag) === -1
73+
);
74+
}
75+
76+
config.addFilter('filterTagList', filterTagList);
77+
78+
// Create an array of all tags
79+
config.addCollection('tagList', function (collection) {
80+
let tagSet = new Set();
81+
collection.getAll().forEach((item) => {
82+
(item.data.tags || []).forEach((tag) => tagSet.add(tag));
83+
});
84+
85+
return filterTagList([...tagSet]);
86+
});
87+
88+
// Customize Markdown library and settings:
89+
let markdownLibrary = markdownIt({
90+
html: true,
91+
breaks: true,
92+
linkify: true,
93+
}).use(markdownItAnchor, {
94+
permalink: markdownItAnchor.permalink.ariaHidden({
95+
placement: 'after',
96+
class: 'direct-link',
97+
symbol: '#',
98+
level: [1, 2, 3, 4],
99+
}),
100+
slugify: config.getFilter('slug'),
101+
});
102+
config.setLibrary('md', markdownLibrary);
103+
104+
// Override Browsersync defaults (used only with --serve)
105+
config.setBrowserSyncConfig({
106+
callbacks: {
107+
ready: function (err, browserSync) {
108+
const content_404 = fs.readFileSync('_site/404/index.html');
109+
110+
browserSync.addMiddleware('*', (req, res) => {
111+
// Provides the 404 content without redirect.
112+
res.writeHead(404, { 'Content-Type': 'text/html; charset=UTF-8' });
113+
res.write(content_404);
114+
res.end();
115+
});
116+
},
117+
},
118+
ui: false,
119+
ghostMode: false,
120+
});
121+
122+
// Set image shortcodes
123+
config.addLiquidShortcode('image', imageShortcode);
124+
config.addLiquidShortcode('image_with_class', imageWithClassShortcode);
125+
config.addLiquidShortcode("uswds_icon", function (name) {
126+
return `
127+
<svg class="usa-icon" aria-hidden="true" role="img">
128+
<use xlink:href="#svg-${name}"></use>
129+
</svg>`;
130+
});
131+
132+
// If BASEURL env variable exists, update pathPrefix to the BASEURL
133+
if (process.env.BASEURL) {
134+
pathPrefix = process.env.BASEURL
135+
}
136+
137+
return {
138+
// Control which files Eleventy will process
139+
// e.g.: *.md, *.njk, *.html, *.liquid
140+
templateFormats: ['md', 'njk', 'html', 'liquid'],
141+
142+
// Pre-process *.md files with: (default: `liquid`)
143+
// Other template engines are available
144+
// See https://www.11ty.dev/docs/languages/ for other engines.
145+
markdownTemplateEngine: 'liquid',
146+
147+
// Pre-process *.html files with: (default: `liquid`)
148+
// Other template engines are available
149+
// See https://www.11ty.dev/docs/languages/ for other engines.
150+
htmlTemplateEngine: 'liquid',
151+
152+
// -----------------------------------------------------------------
153+
// If your site deploys to a subdirectory, change `pathPrefix`.
154+
// Don’t worry about leading and trailing slashes, we normalize these.
155+
156+
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
157+
// This is only used for link URLs (it does not affect your file structure)
158+
// Best paired with the `url` filter: https://www.11ty.dev/docs/filters/url/
159+
160+
// You can also pass this in on the command line using `--pathprefix`
161+
162+
// Optional (default is shown)
163+
pathPrefix: pathPrefix,
164+
// -----------------------------------------------------------------
165+
166+
// These are all optional (defaults are shown):
167+
dir: {
168+
input: '.',
169+
includes: '_includes',
170+
data: '_data',
171+
output: '_site',
172+
},
173+
};
174+
};

.eleventyignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONTRIBUTING.md
2+
LICENSE.md
3+
README.md
4+
.github
5+
config

.gitignore

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# General
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
# Icon must end with two \r
7+
Icon
8+
9+
# Thumbnails
10+
._*
11+
12+
# Files that might appear in the root of a volume
13+
.DocumentRevisions-V100
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
.com.apple.timemachine.donotpresent
20+
21+
# Directories potentially created on remote AFP share
22+
.AppleDB
23+
.AppleDesktop
24+
Network Trash Folder
25+
Temporary Items
26+
.apdisk
27+
28+
# Logs
29+
logs
30+
*.log
31+
npm-debug.log*
32+
yarn-debug.log*
33+
yarn-error.log*
34+
lerna-debug.log*
35+
.pnpm-debug.log*
36+
37+
# Diagnostic reports (https://nodejs.org/api/report.html)
38+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
39+
40+
# Runtime data
41+
pids
42+
*.pid
43+
*.seed
44+
*.pid.lock
45+
46+
# Directory for instrumented libs generated by jscoverage/JSCover
47+
lib-cov
48+
49+
# Coverage directory used by tools like istanbul
50+
coverage
51+
*.lcov
52+
53+
# nyc test coverage
54+
.nyc_output
55+
56+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
57+
.grunt
58+
59+
# Bower dependency directory (https://bower.io/)
60+
bower_components
61+
62+
# node-waf configuration
63+
.lock-wscript
64+
65+
# Compiled binary addons (https://nodejs.org/api/addons.html)
66+
build/Release
67+
68+
# Dependency directories
69+
node_modules/
70+
jspm_packages/
71+
72+
# Snowpack dependency directory (https://snowpack.dev/)
73+
web_modules/
74+
75+
# TypeScript cache
76+
*.tsbuildinfo
77+
78+
# Optional npm cache directory
79+
.npm
80+
81+
# Optional eslint cache
82+
.eslintcache
83+
84+
# Optional stylelint cache
85+
.stylelintcache
86+
87+
# Microbundle cache
88+
.rpt2_cache/
89+
.rts2_cache_cjs/
90+
.rts2_cache_es/
91+
.rts2_cache_umd/
92+
93+
# Optional REPL history
94+
.node_repl_history
95+
96+
# Output of 'npm pack'
97+
*.tgz
98+
99+
# Yarn Integrity file
100+
.yarn-integrity
101+
102+
# dotenv environment variable files
103+
.env
104+
.env.development.local
105+
.env.test.local
106+
.env.production.local
107+
.env.local
108+
109+
# Stores VSCode versions used for testing VSCode extensions
110+
.vscode-test
111+
112+
# yarn v2
113+
.yarn/cache
114+
.yarn/unplugged
115+
.yarn/build-state.yml
116+
.yarn/install-state.gz
117+
.pnp.*
118+
119+
# 11ty Related
120+
_site
121+
public
122+
node_modules

404.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: layouts/wide
3+
---
4+
5+
<div class="grid-row grid-gap">
6+
<div class="usa-layout-docs-main_content desktop:grid-col-9 usa-prose">
7+
<h1>>Page not found</strong></h1>
8+
<p>The requested page could not be found (404).</p>
9+
</div>
10+
</div>

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Welcome!
2+
3+
We're so glad you're thinking about contributing to a [open source project of the U.S. government](https://code.gov/)! If you're unsure about anything, just ask -- or submit the issue or pull request anyway. The worst that can happen is you'll be politely asked to change something. We love all friendly contributions.
4+
5+
We encourage you to read this project's CONTRIBUTING policy (you are here), its [LICENSE](LICENSE.md), and its [README](README.md).
6+
7+
## Policies
8+
9+
We want to ensure a welcoming environment for all of our projects. Our staff follow the [TTS Code of Conduct](https://18f.gsa.gov/code-of-conduct/) and all contributors should do the same.
10+
11+
We adhere to the [18F Open Source Policy](https://github.com/18f/open-source-policy). If you have any questions, just [shoot us an email](mailto:[email protected]).
12+
13+
As part of a U.S. government agency, the General Services Administration (GSA)’s Technology Transformation Services (TTS) takes seriously our responsibility to protect the public’s information, including financial and personal information, from unwarranted disclosure. For more information about security and vulnerability disclosure for our projects, please read our [18F Vulnerability Disclosure Policy](https://18f.gsa.gov/vulnerability-disclosure-policy/).
14+
15+
## Public domain
16+
17+
This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
18+
19+
All contributions to this project will be released under the CC0 dedication. By submitting a pull request or issue, you are agreeing to comply with this waiver of copyright interest.

Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:18
2+
3+
WORKDIR /src
4+
5+
COPY ./package.json /src/package.json
6+
COPY ./package-lock.json /src/package-lock.json
7+
8+
RUN npm ci
9+
10+
CMD npm run start

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# License
2+
3+
As a work of the [United States government](https://www.usa.gov/), this project is in the public domain within the United States of America.
4+
5+
Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication.
6+
7+
## CC0 1.0 Universal Summary
8+
9+
This is a human-readable summary of the [Legal Code (read the full text)](https://creativecommons.org/publicdomain/zero/1.0/legalcode).
10+
11+
### No Copyright
12+
13+
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
14+
15+
You can copy, modify, distribute, and perform the work, even for commercial purposes, all without asking permission.
16+
17+
### Other Information
18+
19+
In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights.
20+
21+
Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. When using or citing the work, you should not imply endorsement by the author or the affirmer.

0 commit comments

Comments
 (0)