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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Get url page via twig

Solved by Claud Rusnac View solution

Started by Claud Rusnac 8 years ago · 2 replies · 2526 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 Pedro M, 2 months ago
4 193 2 months ago
Themes & Styling · by Ian, 2 months ago
3 90 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 449 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 43 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 123 3 months ago