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

Docs incorrect (or found bug?) about Front Matter in Pug layouts #1465

Open
Zearin opened this issue Aug 28, 2022 · 0 comments
Open

Docs incorrect (or found bug?) about Front Matter in Pug layouts #1465

Zearin opened this issue Aug 28, 2022 · 0 comments

Comments

@Zearin
Copy link
Contributor

Zearin commented Aug 28, 2022

Relevant Docs

The docs for Layouts say:

Layouts can contain their own front matter data!


The problem

I’m using Pug as my template language of choice, and I just tried to add some Front Matter to a layout for the first time. Pug sees the front matter code and chokes when attempting to parse it.

Error output

[11ty] Original error stack trace: Error: _src/_layouts/default.pug:2:1
[11ty]     1| ---js
[11ty]   > 2| {
[11ty] -------^
[11ty]     3|     cssListAppend: null
[11ty]     4| }
[11ty]     5| ---
[11ty] 
[11ty] unexpected text "{
[11ty]    "
[11ty]     at makeError (/Users/amrogers/Projects/uof-11ty/node_modules/pug-error/index.js:34:13)
[11ty]     at Lexer.error (/Users/amrogers/Projects/uof-11ty/node_modules/pug-lexer/index.js:62:15)
[11ty]     at Lexer.fail (/Users/amrogers/Projects/uof-11ty/node_modules/pug-lexer/index.js:1629:10)
[11ty]     at Lexer.advance (/Users/amrogers/Projects/uof-11ty/node_modules/pug-lexer/index.js:1694:12)
[11ty]     at Lexer.callLexerFunction (/Users/amrogers/Projects/uof-11ty/node_modules/pug-lexer/index.js:1647:23)
[11ty]     at Lexer.getTokens (/Users/amrogers/Projects/uof-11ty/node_modules/pug-lexer/index.js:1706:12)
[11ty]     at lex (/Users/amrogers/Projects/uof-11ty/node_modules/pug-lexer/index.js:12:42)
[11ty]     at Object.lex (/Users/amrogers/Projects/uof-11ty/node_modules/pug/lib/index.js:104:9)
[11ty]     at Function.loadString [as string] (/Users/amrogers/Projects/uof-11ty/node_modules/pug-load/index.js:53:24)
[11ty]     at /Users/amrogers/Projects/uof-11ty/node_modules/pug-load/index.js:37:27
[11ty] Copied 27 files / Wrote 0 files in 4.61 seconds (v1.0.2)

My speculation

Since each parser only knows its own language (but not front matter), my guess is that Eleventy is sending the entire file contents to the Pug parser, when it should be pre-processing the front matter first and sending only Pug code to the Pug parser.


Eleventy Version

  • Eleventy version: 1.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant