You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a template file foo.md with this front matter (simplified for ease-of-reading):
---
date: 2021-10-01
slug: foo
title: Foo Is Great
---
That file is written to /2021/10-foo via a permalink item in *.11data.json file. Now I have another file bar.md which is connected to foo.md using a front matter item that contains foo's permalink:
Can I use the slug from foo.md to generate the permalink for bar.md? I'd like it to be something like /2021/11-foo-linked.
I can attach front matter items in .eleventy.js by creating a collection, looping through, and adding items where linkedPageUrl equals page.url. I can thus use foo's title in bar (e.g. <h1>bar (this page is linked to <b>Foo Is Great</b>)</h1>).
But I have not successfully used foo's slug for bar's permalink. I've tried using eleventyComputed, but I don't really understand what I'm doing, so I don't know if I'm doing it wrong or I'm trying to do something that can't be done.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a template file
foo.md
with this front matter (simplified for ease-of-reading):That file is written to
/2021/10-foo
via a permalink item in*.11data.json
file. Now I have another filebar.md
which is connected tofoo.md
using a front matter item that containsfoo
's permalink:Can I use the
slug
fromfoo.md
to generate the permalink forbar.md
? I'd like it to be something like/2021/11-foo-linked
.I can attach front matter items in .eleventy.js by creating a collection, looping through, and adding items where
linkedPageUrl
equalspage.url
. I can thus usefoo
'stitle
inbar
(e.g.<h1>bar (this page is linked to <b>Foo Is Great</b>)</h1>
).But I have not successfully used
foo
's slug forbar
's permalink. I've tried using eleventyComputed, but I don't really understand what I'm doing, so I don't know if I'm doing it wrong or I'm trying to do something that can't be done.Beta Was this translation helpful? Give feedback.
All reactions