Skip to content
Grav 2.0 is officially stable. Read the announcement →
Forms & Blueprints

Page Field for page name output

Started by Patrick Hoehn 9 years ago · 7 replies · 973 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

7 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1641 6 months ago
Forms & Blueprints · by Hugo Oliveira, 7 months ago
0 329 7 months ago
Forms & Blueprints · by Flachy Joe, 8 months ago
9 430 8 months ago
Forms & Blueprints · by Augustus, 8 months ago
7 444 8 months ago
Forms & Blueprints · by Julien, 8 months ago
10 478 8 months ago