Skip to content

Regarding generation of multiple files from a single content template #1824

Answered by pdehaan
studiolastco asked this question in Q&A
Discussion options

You must be logged in to vote

Question: Is there some way to make the first map to {{artwork.data.title}} or the second map to just {{title}}? I'm trying to avoid duplicating a layout used by two different page generation sources.

I think there might be 2 solutions:

  1. Use LiquidJS's default filter (assuming you're using the default engine for .md files and didn't replace it w/ Nunjucks; in which case you'd have to write your own default filter):
<title>{{ title | default: artwork.data.title }}</title>

This should use title if available, and fall back to artwork.data.title if title was falsy.

  1. Use eleventyComputed in your paginated pages to set local variables.
---
# ./works-abstract.md
layout: layouts/works/artwork
t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@studiolastco
Comment options

Answer selected by studiolastco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants