Skip to content

Commit 17ca143

Browse files
johnsgpmaverickvi
authored andcommitted
Use the service_link at the start of the path to the favicon images if required
1 parent c6be4b9 commit 17ca143

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Unreleased
2+
3+
- [Fix: Use the service link as the start of the path to the favicon images if required](https://github.com/alphagov/tech-docs-gem/pull/399)
4+
5+
To use the service_link at the start of the path to the favicon images, you need to
6+
- set `use_service_link_for_favicon: true`
7+
18
## 4.3.1
29

310
- Revert [Fix: Use the service link as the start of the path to the favicon images](https://github.com/alphagov/tech-docs-gem/pull/391)

lib/source/layouts/core.erb

+18-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,24 @@
1111

1212
<link rel="canonical" href="<%= meta_tags.canonical_url %>">
1313
<% if config[:tech_docs][:show_govuk_logo] %>
14-
<link rel="icon" sizes="48x48" href="/assets/govuk/assets/images/favicon.ico">
15-
<link rel="icon" sizes="any" href="/assets/govuk/assets/images/favicon.svg" type="image/svg+xml">
16-
<link rel="mask-icon" href="/assets/govuk/assets/images/govuk-icon-mask.svg" color="#0b0c0c">
17-
<link rel="apple-touch-icon" href="/assets/govuk/assets/images/govuk-icon-180.png">
18-
<link rel="manifest" href="/assets/govuk/assets/manifest.json">
14+
<%
15+
path_prefix =
16+
if !development? && config[:tech_docs][:use_service_link_for_favicon]
17+
service_link = config[:tech_docs][:service_link] || '/'
18+
# ensure service_link ends with a trailing '/'
19+
if service_link[-1, 1] != '/'
20+
service_link += '/'
21+
end
22+
service_link
23+
else
24+
'/'
25+
end
26+
%>
27+
<link rel="icon" sizes="48x48" href="<%= path_prefix %>assets/govuk/assets/images/favicon.ico">
28+
<link rel="icon" sizes="any" href="<%= path_prefix %>assets/govuk/assets/images/favicon.svg" type="image/svg+xml">
29+
<link rel="mask-icon" href="<%= path_prefix %>assets/govuk/assets/images/govuk-icon-mask.svg" color="#0b0c0c">
30+
<link rel="apple-touch-icon" href="<%= path_prefix %>assets/govuk/assets/images/govuk-icon-180.png">
31+
<link rel="manifest" href="<%= path_prefix %>assets/govuk/assets/manifest.json">
1932
<% else %>
2033
<link rel="icon" sizes="48x48" href="/images/favicon.ico">
2134
<link rel="icon" sizes="any" href="/images/favicon.svg" type="image/svg+xml">

0 commit comments

Comments
 (0)