govuk_tech_docs 2.0.13 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of govuk_tech_docs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/example/source/index.html.md.erb +1 -0
- data/example/source/prevent-index-page.html.md +10 -0
- data/lib/govuk_tech_docs/meta_tags.rb +27 -8
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/source/layouts/core.erb +3 -6
- data/package-lock.json +3 -3
- 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: e6eb13261f7f9ed89665a78f4a39b41936486bbbb945de36818908d703f078cd
|
4
|
+
data.tar.gz: b968b91fe10b4075ed1544d7a98e8f4257401464f138c790ee1290d597a1e018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdbe93545cd55d9b8ae9d9d2490c08e9e55bccceb5653b9d5ab680ce141b3238391d12949b50df6b52821847e8902891f6d1c5ed76417b7f6dbe035735b92702
|
7
|
+
data.tar.gz: 1becd936b596332a278fd5895f6f37ad67356b862bdb33bd5df6d1aa49f441bdfd2a2b94cd9f4bb75d15fbc54c94568a0be12629ecefbd1809ed7013aef67c81
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 2.1.0
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
#### Exclude pages from search engine results
|
10
|
+
|
11
|
+
You can now exclude a page from search engine results by including `prevent_indexing: true` in the page's frontmatter.
|
12
|
+
|
13
|
+
This was added in [pull request #192: Fixes and improvements to meta tags](https://github.com/alphagov/tech-docs-gem/pull/192).
|
14
|
+
|
15
|
+
### Fixes
|
16
|
+
|
17
|
+
We’ve made fixes in the following pull requests:
|
18
|
+
|
19
|
+
- [#192: Fixes and improvements to meta tags](https://github.com/alphagov/tech-docs-gem/pull/192)
|
20
|
+
|
3
21
|
## 2.0.13
|
4
22
|
|
5
23
|
- [Pull request #189: Update orange code highlight colour to meet minimum AA colour contrast ratio criterion](https://github.com/alphagov/tech-docs-gem/pull/189)
|
@@ -8,12 +8,8 @@ module GovukTechDocs
|
|
8
8
|
def tags
|
9
9
|
all_tags = {
|
10
10
|
"description" => page_description,
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"og:site_name" => site_name,
|
14
|
-
"og:title" => page_title,
|
15
|
-
"og:type" => "object",
|
16
|
-
"og:url" => canonical_url,
|
11
|
+
"google-site-verification" => google_site_verification,
|
12
|
+
"robots" => robots,
|
17
13
|
"twitter:card" => "summary",
|
18
14
|
"twitter:domain" => URI.parse(host).host,
|
19
15
|
"twitter:image" => page_image,
|
@@ -24,6 +20,21 @@ module GovukTechDocs
|
|
24
20
|
Hash[all_tags.select { |_k, v| v }]
|
25
21
|
end
|
26
22
|
|
23
|
+
# OpenGraph uses the non-standard property attribute instead of name, so we
|
24
|
+
# return these separately so we can output them correctly.
|
25
|
+
def opengraph_tags
|
26
|
+
all_opengraph_tags = {
|
27
|
+
"og:description" => page_description,
|
28
|
+
"og:image" => page_image,
|
29
|
+
"og:site_name" => site_name,
|
30
|
+
"og:title" => page_title,
|
31
|
+
"og:type" => "object",
|
32
|
+
"og:url" => canonical_url,
|
33
|
+
}
|
34
|
+
|
35
|
+
Hash[all_opengraph_tags.select { |_k, v| v }]
|
36
|
+
end
|
37
|
+
|
27
38
|
def browser_title
|
28
39
|
[page_title, site_name].select(&:present?).uniq.join(" - ")
|
29
40
|
end
|
@@ -45,11 +56,19 @@ module GovukTechDocs
|
|
45
56
|
end
|
46
57
|
|
47
58
|
def page_description
|
48
|
-
locals[:description] || frontmatter
|
59
|
+
locals[:description] || frontmatter[:description]
|
49
60
|
end
|
50
61
|
|
51
62
|
def page_title
|
52
|
-
locals[:title] || frontmatter
|
63
|
+
locals[:title] || frontmatter[:title]
|
64
|
+
end
|
65
|
+
|
66
|
+
def robots
|
67
|
+
"noindex" if config[:tech_docs][:prevent_indexing] || frontmatter[:prevent_indexing]
|
68
|
+
end
|
69
|
+
|
70
|
+
def google_site_verification
|
71
|
+
config[:tech_docs][:google_site_verification]
|
53
72
|
end
|
54
73
|
|
55
74
|
def host
|
data/lib/source/layouts/core.erb
CHANGED
@@ -4,9 +4,6 @@
|
|
4
4
|
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
5
5
|
<meta charset="utf-8">
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
7
|
-
<% if config[:tech_docs][:prevent_indexing] %>
|
8
|
-
<meta name="robots" content="noindex">
|
9
|
-
<% end %>
|
10
7
|
|
11
8
|
<title><%= meta_tags.browser_title %></title>
|
12
9
|
|
@@ -14,11 +11,11 @@
|
|
14
11
|
|
15
12
|
<link rel="canonical" href="<%= meta_tags.canonical_url %>">
|
16
13
|
|
17
|
-
<%
|
18
|
-
|
14
|
+
<% meta_tags.tags.each do |name, content| %>
|
15
|
+
<%= tag :meta, name: name, content: content %>
|
19
16
|
<% end %>
|
20
17
|
|
21
|
-
<% meta_tags.
|
18
|
+
<% meta_tags.opengraph_tags.each do |property, content| %>
|
22
19
|
<%= tag :meta, property: property, content: content %>
|
23
20
|
<% end %>
|
24
21
|
|
data/package-lock.json
CHANGED
@@ -1108,9 +1108,9 @@
|
|
1108
1108
|
}
|
1109
1109
|
},
|
1110
1110
|
"lodash": {
|
1111
|
-
"version": "4.17.
|
1112
|
-
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.
|
1113
|
-
"integrity": "sha512-
|
1111
|
+
"version": "4.17.19",
|
1112
|
+
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
1113
|
+
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
|
1114
1114
|
"dev": true
|
1115
1115
|
},
|
1116
1116
|
"loose-envify": {
|
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.1.0
|
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: 2020-07
|
11
|
+
date: 2020-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -363,6 +363,7 @@ files:
|
|
363
363
|
- example/source/nested-page/index.html.md
|
364
364
|
- example/source/not-expired-page.html.md
|
365
365
|
- example/source/pets.yml
|
366
|
+
- example/source/prevent-index-page.html.md
|
366
367
|
- example/source/stylesheets/print.css.scss
|
367
368
|
- example/source/stylesheets/screen-old-ie.css.scss
|
368
369
|
- example/source/stylesheets/screen.css.scss
|