Oak-Harbor-Kits/Starter-Kit-V4-Eleventy

Switch from page.fileslug to page.url

Opened this issue · 1 comments

If you changed the permalink attribute here:

---
layout: 'base.html'
description: 'Meta description for the page'
metaTitle: 'Title that shows up on google searches'
tagTitle: 'Company Name | What They Do | Town and State'
permalink: '**projects2/**'
---

The route would change but the canonical URLs would not. You'd also have to change the markdown filename to project2.md to match.

Urls are being built off the page.fileslug value but should be created off the page.url which defaults to the slug but can be overridden by a 'permalink' value in front matter. They currently all match because the file name matches the permalink value.

So base.html would have this:
<link rel="canonical" href="https://www.website.com{{ page.url }}">

I love Eleventy but it's still a bit of a mess development-wise. They keep the documentation terse; which leads to the Common Pitfall tag being used everywhere to highlight where people run into its unintuitive design. Documenting the quirks deep in their site might be easier on dev resources but informative error messages and verbose example templates would be less condescending. It's really not a 'common pitfall' if PUG processes out the tags you're using in permalinks because you haven't fixed the bug in 4 years.

#6 Resolves this.