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

Checking if current page is root page

Started by Muut Archive 11 years ago · 11 replies · 763 views
11 years ago

How can I check if current page is the root page?

11 years ago

you go to grav admin panel, open that page in it, and go to Advanced.
There you can see if parent is set to root or to something else.

11 years ago

Hey, you got me wrong! I mean in theme-development !

11 years ago
TWIG

{% if page.url == base_url %}
---
11 years ago

Actually should be able to just use:

TWIG
{% if page.root %}
11 years ago
TWIG
{% if page.url == base_url %}

and

TWIG
{% if page.root %}

do not work for me when I load my grav system up to the server !!!

these both only work on my local server (MAMP) ....

11 years ago

Try dumping the values and comparing them on your local and server:

TWIG
{{ dump (page.url) }}
{{ dump (base_url) }}
{{ dump (page.root) }}
11 years ago

where can i see the dumped values ??

11 years ago

I'm new to grav debugging. so i have an open ear !!! and a curious mind !

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1348 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2946 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago