Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

Page Field for page name output

Started by Patrick Hoehn 9 years ago · 7 replies · 1146 views
9 years ago

Hi, I'm new to Grav and here is my first problem: I discovered that the Page Field outputs the complete path to the page but I need the output to be the page name only. With this output I want to generate an anchor link, e.g. #contact but with the output of the Page Field I get something like #/home/contact (it's a modular page). What is the best practise to achieve this?

9 years ago

Hi @iusvar,
Thanks for your answer but it didn't solve my problem. When I use the Page Field, the output is already "/home/contact", so adding slug to the front end output {{ page.header.linked_page.slug }} does not work.

9 years ago

Try only {{ page.slug }}

... if you want to know all of the Page items, write {{ page|dump }}

last edited 11/23/17 by Severo Iuliano
9 years ago

should generally use {{ page.url }}#something

8 years ago

{{page.find(page).title}} did the trick 🙂

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by TomW, 3 days ago
3 80 2 days ago
Forms & Blueprints · by Japhy, 3 weeks ago
2 395 2 weeks ago
Forms & Blueprints · by FrViPofm, 1 month ago
5 395 1 month ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2389 8 months ago
Forms & Blueprints · by Hugo Oliveira, 9 months ago
0 846 9 months ago