Removing the trailing "/" of the domain specified in metadata.js #4284
Unanswered
ironfish1000
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I am using the 11ty / eleventy-base-blog at:
github.com/11ty/eleventy-base-blog
This starter package has metadata.js file with:
in it.
I am creating code to generate meta tags etc.
For eg the Canonical URL I would like to use:
<link rel="canonical" href="{{ metadata.url }}{{ page.url }}">BUT this creates eg:
https://example.com//page-url/with a double "//" after the domain.
So in metadata.js I would like to remove the trailing /:
BUT I am concerned that doing this will break other default parts of the starter package. IE the trailing / has been added to the example.com by default because it is absolutely necessary for the starter package to function properly.
Any help on which way to resolve this is much appreciated.
Edit: I just discovered:
<link rel="canonical" href="{{ page.url | absoluteUrl(metadata.url) }}">provides the absolute url correctly - is this the best way to go?
All reactions