Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Get url page via twig

Solved by Claud Rusnac View solution

Started by Claud Rusnac 9 years ago · 2 replies · 2919 views
9 years ago

I have a URL: /7.0/7.1/7.1.1/7.1.1.4, but trying to access "7.1.1.4" via twig. The

TWIG
{{uri.path}}

Outputs the entire path.

9 years ago Solution

I ended up using:

TWIG
{{uri.path|split('/')|last|split('-')|first}}

since in needed the actual URI that was passed. I am using this on the error.md page, so I couldn't use the slug because it would always show up as "error"

👍 1

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by MarkP, 1 week ago
3 127 3 days ago
Themes & Styling · by TomW, 7 days ago
0 69 7 days ago
Themes & Styling · by themetman, 2 weeks ago
1 162 2 weeks ago
Themes & Styling · by AH, 4 weeks ago
1 278 2 weeks ago
Themes & Styling · by Bruno, 4 years ago
6 1467 2 weeks ago