Closed jasonday closed 4 months ago
Is it possible for you to pre-process value1
in your 11ty data file?
const examplePages = [
{
title: "Contact",
category: "company",
slug: "contact",
}
]
const transform = string => `yay-${string}`
const transformedPages = examplePages.map(page => {
page.category = transform(page.category)
return page
})
module.exports = transformedPages
---
pagination:
data: transformedPages
size: 1
alias: tp
addAllPagesToCollections: true
permalink: "{{ tp.category }}/{{ tp.slug }}/"
---
you get `/yay-company/contact/index.html`
Confirmed this works in the latest Eleventy! See test at https://github.com/11ty/eleventy/commit/a0337317f48af40fcc95769df0f0e960dde38831
I have a shortcode
{% returnSlug data.value %}
that takes the value from the data and returns a slug (specific to how I do slugs in my headless CMS). I want to use the shortcode in the permalink like so:permalink: "standard/{% returnSlug data.value1 %}/criteria/{{ data.value2 }}/index.html"
Is that possible within nunjucks template frontmatter?