Closed do-kevin closed 6 months ago
So what we can do for your detail.pug is:
---
pagination:
data: prismic.products
size: 1
alias: product
permalink: "| detail/#{ product.uid }/index.html"
layout: base
---
block variables
- var template = "detail";
block content
div= `${JSON.stringify(product.slug)}`
.detail
.detail__wrapper
figure.test
The trick is to surround the whole value in quotes. The pipe character is already used in YAML, so surrounding in quotes tells YAML to ignore parsing it. Then pug parses it like it normally would.
The trouble I was facing in the past was in using pagination to map an array of global data objects to individual pages.
product-x.pug
should generate a single page for every product in the site.(edit)
Results in a page for each product, i.e.
Originally posted by @jevets in https://github.com/11ty/eleventy/issues/286#issuecomment-436247985