Skip to content
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

Permalink path being encoded #5

Open
colindresj opened this issue Sep 23, 2020 · 5 comments
Open

Permalink path being encoded #5

colindresj opened this issue Sep 23, 2020 · 5 comments
Labels
bug Something isn't working 📦 pug

Comments

@colindresj
Copy link

Describe the bug
If I set the permalink for a page (in any way) the output contains what looks like HTML.

For example, if I set the following on my src/404.pug:

---
permalink: 404.html
---

The following gets written:

Writing _site/<404 class="html"></404> from ./src/404.pug.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project and set set templateFormats to ['pug']
  2. Create a pug template with permalink set in the frontmatter
  3. Build
  4. See error

Expected behavior
Expecting the following:

Writing _site/404.html from ./src/404.pug.

Environment:

  • OS and Version: [e.g. Windows/Mac/Linux]
    Using version 0.11.0 on mac
@binyamin
Copy link
Member

binyamin commented Sep 24, 2020

Thanks for reporting. I can reproduce this with any permalink. I'll look into it a bit.

@binyamin binyamin added the bug Something isn't working label Sep 24, 2020
@binyamin
Copy link
Member

binyamin commented Sep 24, 2020

According to 11ty/eleventy#539 (comment), you need to enclose the value in quotes and prefix it with a pipe "|" character. The reason is that pug is trying to compile it as code.

It's still not expected behavior.

@awmottaz
Copy link

I ran into this same issue using WebC. The following source file causes an error on build:

404.webc

---
permalink: 404.html
---

In the WebC case, the fix is either to "double quote" the value, like this:

---
permalink: "'404.html'"
---

Or disable template processing of the permalink:

---
permalink: 404.html
dynamicPermalink: false
---

@zachleat
Copy link
Member

@awmottaz I filed that separate WebC issue at 11ty/eleventy-plugin-webc#47

Thanks!

Alternatively the pug issue is still present in 2.0. Workaround is to use dynamicPermalink!

@zachleat zachleat transferred this issue from 11ty/eleventy Jul 10, 2024
@paulbrzeski
Copy link

paulbrzeski commented Sep 20, 2024

Having the same issue using pagination and custom data.

For now it's easy enough to just use njk for front matter files and pug for the rest :)

My file

---
layout: blog.pug
date: #{blogpost.modified}
pagination:
  data: blogposts
  size: 1
  alias: blogpost
permalink: blog/#{blogpost.slug}/
---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 pug
Projects
None yet
Development

No branches or pull requests

5 participants