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

process frontmatter for dynamic permalinks including the tag-names using WebC #3073

Open
johannesrave opened this issue Oct 20, 2023 · 1 comment

Comments

@johannesrave
Copy link

Operating system

Ubuntu 23.04

Eleventy

2.01

Describe the bug

I'm trying to generate index-pages for my tags using pagination, pretty much following the Quick Tip from the documentation, except for the fact I recently ported my page to WebC instead of Liquid. However, I cannot figure out how to format the permalinks to generate the pages based on the tag-names, which in Liquid would've been done like so:

---
pagination:
  data: collections
  size: 1
  alias: tag
  filter: [all]
permalink: "tags/{{ tag }}/"
---

Using several permutations of guessing how to writr this in WebC, template-strings and javascript-style-frontmatter, I'm always getting something to the tune of

Eleventy:EleventyErrorHandler (error stack): DuplicatePermalinkOutputError: Output conflict: multiple input files are writing to `public/tags/{{ tag }}/index.html`. Use distinct `permalink` values to resolve this conflict.
  Eleventy:EleventyErrorHandler   1. ./blog/tags/pagination.webc
  Eleventy:EleventyErrorHandler   2. ./blog/tags/pagination.webc
  Eleventy:EleventyErrorHandler   3. ./blog/tags/pagination.webc

I'm more confused by the fact that in another WebC-template, the double-curly format to generate my posts at date-based urls appears to be working fine:

---
layout: "_layouts/document.webc"
title: my title
permalink: "posts/{{ page.date | date: '%Y' }}/{{ page.date | date: '%m' }}/{{ page.date | date: '%d' }}/{{ title | slugify }}"
tags: post
---

is it because there are filters involved? I've spent several hours on this and am now stumped and feel stupid, would be thankful for a pointer or a workaround.

Reproduction steps

generate pages with dynamic permalinks including the tag-names using the pagination feature in a WebC-template

Expected behavior

pages are generated like

/tags/personal/index.html
/tags/til/index.html
...

Reproduction URL

No response

Screenshots

No response

@johannesrave
Copy link
Author

johannesrave commented Oct 20, 2023

update:
i found the issues pertaining to the exact formatting of the permalink with webc in https://github.com/11ty/eleventy-plugin-webc, so sorry for posting here.

the relevant (resolved) issues were namely 11ty/eleventy-plugin-webc#27 and 11ty/eleventy-plugin-webc#36.

from those threads i learned that i have to format it like permalink: "'/tags/' + tag + '/'" (the difference to what i tried before being that nested quotes i think, as if eval-ing the string).

unfortunately, i ran into 11ty/eleventy-plugin-webc#87 right after.

i'm also still hazy on why the liquid-style double curlies work in the other case illustrated in my original post, as that is also inside a .webc-file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant