govuk_tech_docs 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/docs/configuration.md +11 -0
- data/docs/frontmatter.md +11 -0
- data/example/config/tech-docs.yml +4 -0
- data/example/source/hidden-page.html.md +10 -0
- data/lib/govuk_tech_docs/table_of_contents/helpers.rb +8 -6
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/source/layouts/_footer.erb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d94433dc8c529cf1fe8e1d5793f889026a6cfc67a25c3e23f25e6bdf7bfc3886
|
|
4
|
+
data.tar.gz: 034413e2c01e297f2fb469296621feebbde22b28959f85d43b679b0026764fec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6bd3abb0caff2bdc339409540f3d845d964815e84ac4fa85df937db112ed13e79f589b57b28a36ef948dda2dfd38ef22ea901c0fa989035f473cb429b6226e2c
|
|
7
|
+
data.tar.gz: 87558e6beeb2dd2d92c14f430de2306b6b58449f9557f80d83701b54e7558e43901b35f25080821e2183c22181e4ecddfb96bbd11e6044b9329a9384e20f9bda
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
Adds `footer_links` option for displaying links in the footer and ability to hide pages from left hand navigation.
|
|
6
|
+
|
|
3
7
|
## 2.0.3
|
|
4
8
|
|
|
5
9
|
Fixes a couple of styling issues: [#100](https://github.com/alphagov/tech-docs-gem/issues/100) and [#106](https://github.com/alphagov/tech-docs-gem/issues/106).
|
data/docs/configuration.md
CHANGED
|
@@ -55,6 +55,17 @@ header_links:
|
|
|
55
55
|
Documentation: /
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
## `footer_links`
|
|
59
|
+
|
|
60
|
+
Links to show in footer.
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
footer_links:
|
|
66
|
+
Accessibility: /accessibility
|
|
67
|
+
```
|
|
68
|
+
|
|
58
69
|
## `host`
|
|
59
70
|
|
|
60
71
|
Host to use for canonical URL generation (without trailing slash).
|
data/docs/frontmatter.md
CHANGED
|
@@ -132,6 +132,17 @@ weight: 20
|
|
|
132
132
|
---
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
+
## `hide_in_navigation`
|
|
136
|
+
|
|
137
|
+
Set `hide_in_navigation: true` to prevent the page from being rendered in the
|
|
138
|
+
main page tree navigation.
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
---
|
|
142
|
+
hide_in_navigation: true
|
|
143
|
+
---
|
|
144
|
+
```
|
|
145
|
+
|
|
135
146
|
## `parent`
|
|
136
147
|
|
|
137
148
|
The page that should be highlighted as ‘active’ in the navigation.
|
|
@@ -14,6 +14,10 @@ header_links:
|
|
|
14
14
|
Expired with owner: /expired-page-with-owner.html
|
|
15
15
|
Not expired page: /not-expired-page.html
|
|
16
16
|
|
|
17
|
+
footer_links:
|
|
18
|
+
Accessibility: /hidden-page.html
|
|
19
|
+
Hidden Page: /hidden-page.html
|
|
20
|
+
|
|
17
21
|
# Tracking ID from Google Analytics (e.g. UA-XXXX-Y)
|
|
18
22
|
ga_tracking_id:
|
|
19
23
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hidden page
|
|
3
|
+
hide_in_navigation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# This is a hidden page
|
|
7
|
+
|
|
8
|
+
Sometimes you don't want a page to show up in main nagivation, for example,
|
|
9
|
+
when you want to link to it from footer. Setting `hide_in_navigation: true`
|
|
10
|
+
frontmatter will prevent a link being generated in the navigation.
|
|
@@ -34,14 +34,16 @@ module GovukTechDocs
|
|
|
34
34
|
.sort_by { |r| [r.data.weight ? 0 : 1, r.data.weight || 0] }
|
|
35
35
|
output = '';
|
|
36
36
|
resources.each do |resource|
|
|
37
|
+
# Skip from page tree if hide_in_navigation:true frontmatter
|
|
38
|
+
next if resource.data.hide_in_navigation
|
|
39
|
+
|
|
37
40
|
# Reuse the generated content for the active page
|
|
38
41
|
# If we generate it twice it increments the heading ids
|
|
39
|
-
content =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
end
|
|
42
|
+
content = if current_page.url == resource.url && current_page_html
|
|
43
|
+
current_page_html
|
|
44
|
+
else
|
|
45
|
+
resource.render(layout: false)
|
|
46
|
+
end
|
|
45
47
|
# Avoid redirect pages
|
|
46
48
|
next if content.include? "http-equiv=refresh"
|
|
47
49
|
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
<div class="govuk-footer__meta">
|
|
3
3
|
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
|
|
4
4
|
|
|
5
|
+
<% if config[:tech_docs][:footer_links] %>
|
|
6
|
+
<ul class="govuk-footer__inline-list">
|
|
7
|
+
<% config[:tech_docs][:footer_links].each do |title, path| %>
|
|
8
|
+
<li class="govuk-footer__inline-list-item">
|
|
9
|
+
<a class="govuk-footer__link" href="<%= url_for path %>"><%= title %></a>
|
|
10
|
+
</li>
|
|
11
|
+
<% end %>
|
|
12
|
+
</ul>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
5
15
|
<svg
|
|
6
16
|
role="presentation"
|
|
7
17
|
focusable="false"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_tech_docs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Government Digital Service
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-09-
|
|
11
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -362,6 +362,7 @@ files:
|
|
|
362
362
|
- example/source/expired-page-with-owner.html.md
|
|
363
363
|
- example/source/expired-page.html.md
|
|
364
364
|
- example/source/headings.html.md
|
|
365
|
+
- example/source/hidden-page.html.md
|
|
365
366
|
- example/source/index.html.md.erb
|
|
366
367
|
- example/source/javascripts/application.js
|
|
367
368
|
- example/source/not-expired-page.html.md
|