Hi There,
For my website i want to make it possible in the admin panel to generate dynamic tags with a title and a slug. I want the children of certain main menu to be listed in tags and make it so that in my template, i can perform a foreach on $tag, so that i have a slug and a page title. It seems that ‘fetch’ with a value and a text seems to do the trick, but it’s not working. The page slug is stored in the txt file.
tags:
label: Services
type: tags
options: query
query:
fetch: site.children.template(“services”).children
text: “{{page.title}}”
value: “{{page.slug}}”
in the .txt file i get the following result:
Tags: individual-therapy, group-therapy, therapy-for-eldery-people.
Where i was expecting some kind of array over there.
Can someone help me out?
Why would you need to store the title when you can get the title from the page object?
On the particular page, i want the tags to show their Page Title ( so not the curent page title i’m on) and create a link to that page using the Slug.
I have several team members, for those team members i want to show their services that they can perform and link to that specific service to show more information.
Yes, I understand. But nevertheless, since you can get the page object from the stored slug, you have all the information about the page you need, including its title without storing additional stuff that might even change in the future.
<?php
foreach ($page->tags()->toPages(',') as $page) {
echo $page->title();
echo $page->url();
echo $page->whateverField();
}
Ok thanks, that i didn’t know! awesome CMS