dckc / madmode-blog

my tinkering notebook (blog)
https://www.madmode.com
0 stars 2 forks source link

Eleventy default config doesn't grok html-in-markdown exported from breadcrumbs drupal blog #166

Open dckc opened 2 years ago

dckc commented 2 years ago

Prompted by a nice looking blog item, I tried Eleventy, a simpler static site generator.

It tried to treat breadcrumbs_0089.md, an html-in-markdown file exported from drupal, as a liquid template and failed.

connolly@bldbox:/tmp/site3$ ls ~/projects/madmode-blog/pages/
2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022
connolly@bldbox:/tmp/site3$ cp -rp  ~/projects/madmode-blog/pages/ .
connolly@bldbox:/tmp/site3$ ls
node_modules  package.json  pages  yarn.lock
connolly@bldbox:/tmp/site3$ yarn eleventy --serve
yarn run v1.22.19
warning package.json: No license field
$ /tmp/site3/node_modules/.bin/eleventy --serve
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering liquid template ./pages/2006/breadcrumbs_0089.md (via TemplateContentRenderError)
[11ty] 2. output "{{<br />     ..." not closed, file:./pages/2006/breadcrumbs_0089.md, line:6, col:3912 (via TokenizationError)
[11ty] 3. output "{{<br />     ..." not closed (via Error)
[11ty] 
[11ty] Original error stack trace: Error: output "{{<br />     ..." not closed
[11ty]     at new TokenizationError (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:1140:39)
[11ty]     at Tokenizer.mkError (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:2383:16)
[11ty]     at Tokenizer.readOutputToken (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:2332:24)
[11ty]     at Tokenizer.readTopLevelToken (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:2289:25)
[11ty]     at Tokenizer.readTopLevelTokens (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:2276:30)
[11ty]     at Parser.parse (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:4521:32)
[11ty]     at Liquid.parse (/tmp/site3/node_modules/liquidjs/dist/liquid.node.cjs.js:4660:28)
[11ty]     at Liquid.compile (/tmp/site3/node_modules/@11ty/eleventy/src/Engines/Liquid.js:233:28)
[11ty]     at Markdown.compile (/tmp/site3/node_modules/@11ty/eleventy/src/Engines/Markdown.js:63:28)
[11ty]     at TemplateRender.getCompiledTemplate (/tmp/site3/node_modules/@11ty/eleventy/src/TemplateRender.js:232:26)
[11ty] Wrote 0 files in 0.19 seconds (v1.0.2)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

When I changed {{ to { {, it didn't crash, but the yaml metadata at the top was treated as markdown content.

dckc commented 1 year ago

11ty on cloudflare pages

Prompted by bumping into Kenton today, I picked up cloudflare pages and ran across Eleventy again:

so I gave it a try:

Directories and URL paths

I'm struggling to reconcile these:

tool file path url path
frozen-flask ./pages/2019/x.md /2019/x.html
11ty ./posts/xyz.md /posts/xyz/

The .html part is straightforward, provided I can find a way to avoid copying it into every post:

permalink: "{{ page.filePathStem }}.html"

There are lots of features to migrate:

image

vs.

image