Skip to content

Commit

Permalink
use htmlBaseUrl filter over absoluteUrl filter from Eleventy’s RSS pl…
Browse files Browse the repository at this point in the history
…ugin
  • Loading branch information
paulrobertlloyd committed Dec 12, 2023
1 parent df1efbf commit 71da857
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion components/site-search/template.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<site-search class="app-site-search govuk-!-display-none-print" index="{{ params.indexPath }}" label="{{ params.label | default("Search site") }}">
<site-search class="app-site-search govuk-!-display-none-print" index="{{ params.indexPath | htmlBaseUrl(options.url) }}" label="{{ params.label | default("Search site") }}">
{%- if params.sitemapPath -%}
<a class="app-site-search__link" href="{{ params.sitemapPath }}">Sitemap</a>
{%- endif -%}
Expand Down
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ module.exports = function (eleventyConfig, pluginOptions = {}) {
// Plugins
eleventyConfig.addPlugin(EleventyHtmlBasePlugin)
eleventyConfig.addPlugin(require('@11ty/eleventy-navigation'))
eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-rss'))

// Events
eleventyConfig.on('eleventy.after', async ({ dir }) => {
Expand Down
12 changes: 6 additions & 6 deletions layouts/base.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "govuk/template.njk" %}

{% set assetUrl = assetPath | absoluteUrl(options.url) %}
{% set assetUrl = assetPath | htmlBaseUrl(options.url) %}
{% set themeColor = options.themeColour %}

{# Only show default Open Graph image if document does not provide its own #}
Expand Down Expand Up @@ -39,17 +39,17 @@
{% endblock %}

{% block head %}
<link rel="stylesheet" href="{{ '/assets/govuk.css' | absoluteUrl(options.url) }}">
<link rel="stylesheet" href="/assets/govuk.css">
{% for stylesheet in options.stylesheets %}
<link rel="stylesheet" href="{{ stylesheet | absoluteUrl(options.url) }}">
<link rel="stylesheet" href="{{ stylesheet }}">
{% endfor %}

<meta property="og:url" content="{{ page.url | absoluteUrl(options.url) }}">
<meta property="og:url" content="{{ page.url | htmlBaseUrl(options.url) }}">
<meta property="og:title" content="{{ title }}">
{% if description %}<meta property="og:description" name="description" content="{{ description | markdown("inline") | striptags(true) }}">{% endif %}
{% if opengraphImage %}<meta name="twitter:card" content="summary_large_image">{% endif %}
{% if opengraphImage.src %}<meta name="twitter:image" content="{{ opengraphImage.src | absoluteUrl(options.url) }}">
<meta property="og:image" content="{{ opengraphImage.src | absoluteUrl(options.url) }}">{% endif %}
{% if opengraphImage.src %}<meta name="twitter:image" content="{{ opengraphImage.src | htmlBaseUrl(options.url) }}">
<meta property="og:image" content="{{ opengraphImage.src | htmlBaseUrl(options.url) }}">{% endif %}
{% if opengraphImage.alt %}<meta property="og:image:alt" content="{{ opengraphImage.alt }}">{% endif %}
{% endblock %}

Expand Down
15 changes: 0 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"dependencies": {
"@11ty/eleventy": "^2.0.0",
"@11ty/eleventy-navigation": "^0.3.2",
"@11ty/eleventy-plugin-rss": "^1.1.2",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@x-govuk/govuk-prototype-components": "^2.2.0",
Expand Down

0 comments on commit 71da857

Please sign in to comment.