Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Get url page via twig

Solved by Claud Rusnac View solution

Started by Claud Rusnac 9 years ago · 2 replies · 2765 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 FrViPofm, 15 hours ago
1 30 3 hours ago
Themes & Styling · by stuart young, 1 month ago
3 480 1 month ago
Themes & Styling · by Sebadamus, 2 months ago
5 481 2 months ago
Themes & Styling · by martynfoster735, 2 months ago
1 460 2 months ago
Themes & Styling · by Justin Young, 2 months ago
1 490 2 months ago