folk.zone Wiki

a public knowledge base

Site Tools


indieweb:eleventy_gotchas

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

indieweb:eleventy_gotchas [2026/09/23 14:52] – created - external edit 127.0.0.1indieweb:eleventy_gotchas [2026/10/23 14:54] (current) – external edit 127.0.0.1
Line 5: Line 5:
 ===== 1. HTML Escaping in Nunjucks ===== ===== 1. HTML Escaping in Nunjucks =====
  
-**Symptom:** Raw HTML tags visible on the rendered page — angle brackets everywhere instead of formatted content.+**Symptom:** Raw HTML tags visible on the rendered page: angle brackets everywhere instead of formatted content.
  
 **Cause:** Nunjucks escapes HTML by default for security. Correct when handling user input; wrong when rendering your own compiled content. **Cause:** Nunjucks escapes HTML by default for security. Correct when handling user input; wrong when rendering your own compiled content.
Line 35: Line 35:
 </code> </code>
  
-**Fix 3:** When grouping by month, use UTC methods — ''getFullYear()''/ ''getMonth()'' still convert to local time even after parsing as UTC:+**Fix 3:** When grouping by month, use UTC methods: ''getFullYear()''/ ''getMonth()'' still convert to local time even after parsing as UTC:
 <code javascript> <code javascript>
 const utcYear  = date.getUTCFullYear(); const utcYear  = date.getUTCFullYear();
Line 46: Line 46:
 ===== 3. collections.all Includes Template Files ===== ===== 3. collections.all Includes Template Files =====
  
-**Symptom:** ''collections.all'' returns more items than you have posts — index.njk or other template files appear as collection items.+**Symptom:** ''collections.all'' returns more items than you have posts: index.njk or other template files appear as collection items.
  
 **Fix:** Be explicit with glob patterns instead of relying on ''collections.all'': **Fix:** Be explicit with glob patterns instead of relying on ''collections.all'':
indieweb/eleventy_gotchas.1790196766.txt.gz · Last modified: by 127.0.0.1