diff --git a/components/site-search/template.njk b/components/site-search/template.njk index 04ee6d3c..88983d57 100644 --- a/components/site-search/template.njk +++ b/components/site-search/template.njk @@ -1,4 +1,4 @@ - + {%- if params.sitemapPath -%} Sitemap {%- endif -%} diff --git a/lib/filters/canonical-url.js b/lib/filters/canonical-url.js index d1829b5a..c9a242ee 100644 --- a/lib/filters/canonical-url.js +++ b/lib/filters/canonical-url.js @@ -6,14 +6,19 @@ const path = require('node:path') * @returns {string} Canonical site URL with resolved path */ module.exports = function (string = '') { - const { url } = this.ctx.options + const { options } = this.ctx + + // No site URL configured + if (!options?.url) { + return string + } // If plugin options do not provide a site URL, return the path - if (!URL.canParse(url)) { + if (!URL.canParse(options.url)) { return string } - const siteUrl = new URL(url) + const siteUrl = new URL(options.url) // If incoming string is a URL, return that if it’s an external URL if (URL.canParse(string)) {