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 |
|---|---|---|---|---|
| 4 | 470 | 2 weeks ago | ||
| 1 | 799 | 3 weeks ago | ||
| 3 | 656 | 2 months ago | ||
| 5 | 678 | 2 months ago | ||
| 1 | 640 | 3 months ago |