Skip to content

Use the service_link at the start of the path to the favicon images i… #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Unreleased

- [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)

To use the service_link at the start of the path to the favicon images, you need to
- set `use_service_link_for_favicon: true`

## 4.3.1

- 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)
Expand Down
23 changes: 18 additions & 5 deletions lib/source/layouts/core.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,24 @@

<link rel="canonical" href="<%= meta_tags.canonical_url %>">
<% if config[:tech_docs][:show_govuk_logo] %>
<link rel="icon" sizes="48x48" href="/assets/govuk/assets/images/favicon.ico">
<link rel="icon" sizes="any" href="/assets/govuk/assets/images/favicon.svg" type="image/svg+xml">
<link rel="mask-icon" href="/assets/govuk/assets/images/govuk-icon-mask.svg" color="#0b0c0c">
<link rel="apple-touch-icon" href="/assets/govuk/assets/images/govuk-icon-180.png">
<link rel="manifest" href="/assets/govuk/assets/manifest.json">
<%
path_prefix =
if !development? && config[:tech_docs][:use_service_link_for_favicon]
service_link = config[:tech_docs][:service_link] || '/'
# ensure service_link ends with a trailing '/'
if service_link[-1, 1] != '/'
service_link += '/'
end
service_link
else
'/'
end
%>
<link rel="icon" sizes="48x48" href="<%= path_prefix %>assets/govuk/assets/images/favicon.ico">
<link rel="icon" sizes="any" href="<%= path_prefix %>assets/govuk/assets/images/favicon.svg" type="image/svg+xml">
<link rel="mask-icon" href="<%= path_prefix %>assets/govuk/assets/images/govuk-icon-mask.svg" color="#0b0c0c">
<link rel="apple-touch-icon" href="<%= path_prefix %>assets/govuk/assets/images/govuk-icon-180.png">
<link rel="manifest" href="<%= path_prefix %>assets/govuk/assets/manifest.json">
<% else %>
<link rel="icon" sizes="48x48" href="/images/favicon.ico">
<link rel="icon" sizes="any" href="/images/favicon.svg" type="image/svg+xml">
Expand Down