sm4rty
March 10, 2023, 3:08pm
1
Hello,
Im trying to set a Site Title (which shows up in the header of the site as link) and a Headline of the Site.
But its not possible for setting the link name and the headline as two different Strings.
How can i set the title / link different to the Headline? When I change one of them in the Panel, both changes (Thats where “Deutsch” is visible.
You could add a field to the template and check if that field isn’t empty and if it isn’t use that string instead of the title.
It could look something like this:
<?php foreach($pages as $page): ?>
<?php if ($page->YOURFIELD()->isNotEmpty()):?>
<?= $page->YOURFIELD() ?>
<?php else: ?>
<?= $page->title() ?>
<?php endif ?>
<?php endforeach ?>
sm4rty
March 13, 2023, 8:38pm
3
thanks. I will try.
There is no easier solution for doing this? because when I update kirby, the solution has to be added again, I think?
No, this doesn’t imply changes to Kirby’s source code, but just your template.
sm4rty
March 13, 2023, 9:51pm
5
ahh I understand. but I dont know how to do.
the title is in the header.php
bit its with $site
and I dont know in which file I find the title() function so I can add an myfield() function.
Sorry for my dumb questions Im no webdeveloper… and try to dig into this stuff.
sm4rty
March 22, 2023, 1:02am
6
ok, I tried… but I dont know where to start exactly can you give me a few more hints for reaching this goal?
would be very nice
Just trying to understand, so in your menu you have Deutsch, Polski, Kontakt, but the headline should not show Deutsch but something else, like Huhn.
Then you have to add a new field in the blueprint for those three pages. The page blueprint is a file in site/blueprints/pages
that has the same name as the content file of those pages, with the extension .yml.
sm4rty
March 22, 2023, 3:23pm
8
yes thats exactly what I want. Im trying to get it up.
thank you all
sm4rty
March 22, 2023, 4:24pm
9
Got it working. Thank you.
I cant mark both answers as solution.
Needed the combination of texnixe and Norreco for getting it up and running.