Skip to content
Grav 2.0 is officially stable. Read the announcement →
Themes & Styling

Get url page via twig

Solved by Claud Rusnac View solution

Started by Claud Rusnac 8 years ago · 2 replies · 2721 views
8 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.

8 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 stuart young, 2 weeks ago
3 251 2 weeks ago
Themes & Styling · by Sebadamus, 3 weeks ago
5 317 2 weeks ago
Themes & Styling · by martynfoster735, 4 weeks ago
1 310 4 weeks ago
Themes & Styling · by Justin Young, 1 month ago
1 348 1 month ago
Themes & Styling · by Slebeig, 2 months ago
4 474 2 months ago