Skip to content

Commit f20893d

Browse files
authored
Adding tests for redirects/noindex (#132)
* Initial commit of tests * Adding npm task for the redirects tests * Adding redirects tests to CI workflow * Fixing index page meta generation logic * Coupling test timeout in package.json
1 parent 60d781c commit f20893d

File tree

6 files changed

+2259
-734
lines changed

6 files changed

+2259
-734
lines changed

.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"env": {
33
"browser": true,
44
"commonjs": true,
5-
"es2021": true
5+
"es2021": true,
6+
"mocha": true
67
},
78
"ignorePatterns": ["/_site"],
89
"extends": ["eslint-config-airbnb-base", "prettier"],

.github/workflows/pull-request.yml

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ jobs:
3030
ELEVENTY_ENV: production
3131
run: npm run build
3232

33+
redirects-tests:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Use Node
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: 18
41+
- name: Install node dependencies
42+
run: npm install
43+
- name: Redirect tests
44+
run: npm run test:redirects
45+
3346
pa11y-scan:
3447
# Pinned to 20.04 because pa11y-ci fails to run on 22.04
3548
# See the discussion on https://github.com/pa11y/pa11y-ci/issues/198

_includes/meta.html

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% comment -%}
2-
You shouldn't have to edit this page very often. But if you want
3-
to modify some of the meta-data for the site, this is the place to do it.
2+
You shouldn't have to edit this page very often. But if you want
3+
to modify some of the meta-data for the site, this is the place to do it.
44
{% endcomment %}
55

66
{%- if tags -%}
@@ -11,24 +11,27 @@
1111

1212
<head>
1313
<!-- Basic Page Needs
14-
================================================== -->
14+
================================================== -->
1515
<meta charset="utf-8" />
1616
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
17+
{%- unless env.production %}
18+
<meta name="robots" content="noindex, nofollow" />
19+
{%- endunless %}
1720
<!-- Mobile Specific Metas
18-
================================================== -->
21+
================================================== -->
1922
<meta name="HandheldFriendly" content="True" />
2023
<meta name="MobileOptimized" content="320" />
2124
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2225
<!-- Title and meta description
23-
================================================== -->
26+
================================================== -->
2427

25-
{% if seo_title %}
26-
{% assign page_title = seo_title | append : ' | 18F ' %}
27-
{% else %}
28-
{% assign page_title = title | append : ' | 18F ' %}
29-
{% endif %}
28+
{% if seo_title %}
29+
{% assign page_title = seo_title | append : ' | 18F ' %}
30+
{% else %}
31+
{% assign page_title = title | append : ' | 18F ' %}
32+
{% endif %}
3033

31-
<title>{{page_title}}{{ titles_roots[guide].title }} </title>
34+
<title>{{page_title}}{{ titles_roots[guide].title }} </title>
3235
<meta property="og:title" content="{{page_title}}{{ titles_roots[guide].title }}" />
3336
<meta name="description" content="{{description}}" />
3437
<meta property="og:description" content="{{description}}" />
@@ -44,7 +47,7 @@
4447
<script async="" src="{{ assetPaths['uswds.js'] }} "></script>
4548

4649
<!-- Favicon
47-
================================================== -->
50+
================================================== -->
4851
<link rel="icon" type="image/png" sizes="16x16" href="{{'/img/favicons/favicon-16x16.png' | url }}">
4952
<link rel="icon" type="image/png" sizes="32x32" href="{{'/img/favicons/favicon-32x32.png' | url }}">
5053
<link rel="icon" type="image/png" sizes="192x192" href="{{'/img/favicons/favicon-192x192.png' | url }}">
@@ -53,7 +56,7 @@
5356
<link rel="apple-touch-icon" sizes="180x180" href="{{'/img/favicons/favicon-180x180.png' | url }}">
5457

5558
<!-- CSS
56-
================================================== -->
59+
================================================== -->
5760
<link rel="preload" as="style" href="{{ assetPaths['styles.css'] }}" />
5861
<link href="https://unpkg.com/[email protected]/themes/prism.css" rel="stylesheet">
5962
<link rel="stylesheet" href="{{ assetPaths['styles.css'] }}" type="text/css" />

0 commit comments

Comments
 (0)