-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
IdAttributePlugin
doesn't generate id
s
#3379
Comments
Howdy! I did attempt to reproduce this with the instructions you provided and was unable to reproduce—can you provide a minimum test case? |
thanks so much for checking out my issue!
so like house MD says, 'everybody lies', and maybe i did without meaning to:
and have it compile. however, still no |
okay, sorry for the wait, MRE is at: to reproduce:
thanks again for having a look! |
I checked this out and opened a PR with some minor changes here johannesrave/eleventy-mre-id-attributeplugin#1 (EDIT: PR branch here https://github.com/rdela/eleventy-mre-id-attributeplugin/tree/rd-debug) Short version is I was not able to determine why
I added Tried jrave_codes@1.0.0-rdela.1 debug
|
A ha, found the issue: You need to use a trailing slash here or .html extension so that we know you’re outputting an html file: // trailing slash
return `posts/${page.date.toISOString().split('T')[0]}/${this.slugify(title)}/
// or .html
return `posts/${page.date.toISOString().split('T')[0]}/${this.slugify(title)}.html |
ah, thank you for taking the time! it works! for future readers and crawlers, the fact that i left out the trailing slash also lead to github pages delivering these transformed mds with content-type i never noticed when using the local dev server, because i think it's more lenient or cleverer about the content type? |
Filed an error messaging improvement issue at #3399 if you want to subscribe! |
Operating system
Ubuntu 23.10
Eleventy
3.0.0-alpha.17
Describe the bug
being the good canary that i am, i am trying to use the new
IdAttributePlugin
introduced in3.0.0.-alpha.17
to generate a table of contents for my blog entries.i added the plugin like in the
Simple usage
example in #3363in my project have two layouts,
_base.webc
and_post.webc
, with the latter being nested in the former. i use the layouts like so:<article @raw="content"></article>
.i work with
.webc
for layouts and components (and some pages) and.md
for blog-entries exclusively.the plugin DOES add
id
s to eg. myindex.webc
orabout.webc
templates, which directly use the_base
layout.however it does NOT generate ids for headings in my
blog-entry.md
templates, which use_post.webc
(which in turn uses_base.webc
).ideas that i have about the potential reasons:
@raw
orcontent
?)i have tried using
@html
inside the layout instead, thinking that that will allow the html-transform to process the content and add the ids, but that should probably have happened before this step anyway?i often have the feeling i might be misunderstanding something in eleventy, so that is very possible of course - if so, what should i change or try?
thanks in advance!
Reproduction steps
@raw="content"
ids
are added to headings in the rendered pageExpected behavior
id
are added to all headings in all types of templates before the time thatcontent
is used in layouts.Reproduction URL
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered: