Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Linking page in a folder to a parent taxonomy page in a different folder

Started by Muut Archive 10 years ago · 2 replies · 340 views
10 years ago

I have 2 folders, songs and artists. My songs have a tax tag 'artists' and every song by an artist is tagged with that. On my artist page I have a page collection with all pages tagged with that artist. My question is, how do i link back to the artist page from the song page? I was thinking something simple like this:

HTML
<p><a href="/somebrothers/artists/{{ page.taxonomy.artist }}">Artist Home</a></p>

But that only works if the tax name is the same as the slug of the artist, and it doesn't work anyway it throws an error.

Thanks!

10 years ago

Ok so this works:

TWIG
    <a href="/somebrothers/artists/{{ tag }}">{{ tag }}</a>
{% endfor %}

But ONLY if the tag is the same as the artist slug - is there a way to 'slugify' a tax tag - currently my tag is 'Foo Fighters' - I need that turned into 'foo-fighters' and it will work.

Thanks

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1369 9 years ago
Archive · by Muut Archive, 9 years ago
2 942 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago