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.
Solved by Claud Rusnac View solution
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
{{uri.path}}
Outputs the entire path.
You want to output the page slug: https://learn.getgrav.org/themes/theme-vars#slug
I ended up using:
{{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"
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 3 | 127 | 3 days ago | ||
| 0 | 69 | 7 days ago | ||
| 1 | 162 | 2 weeks ago | ||
| 1 | 278 | 2 weeks ago | ||
| 6 | 1467 | 2 weeks ago |