Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

pixelfear/Statamic-Segment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

A quick plugin to get the segments of a supplied URL.

{{ segment num="2" url="/blog/categories/whiskey" }}
Outputs: categories

{{ segment num="1" url="/blog/categories/whiskey" }}
Outputs: blog

{{ segment url="/blog/categories/whiskey" }}
Outputs: blog  
(The num parameter defaults to 1)

Use a negative num to get segments from the end of the URL.

{{ segment num="-1" url="/blog/categories/whiskey" }}
Outputs: categories

{{ segment num="-2" url="/blog/categories/whiskey" }}
Outputs: blog

{{ segment url="/blog/categories/whiskey" }}
Outputs: blog

Use segment:url and segment:parent_url to get the full url of segments.
(Note: url will default to current_url for this tag)

{{ segment:url num="2" url="/blog/categories/whiskey" }}
Outputs: /blog/categories

{{ segment:url num="1" url="/blog/categories/whiskey" }}
Outputs: /blog

{{ segment num="-1" url="/blog/categories/whiskey" }}
Outputs: /blog/categories

{{ segment num="-2" url="/blog/categories/whiskey" }}
Outputs: /blog

{{ segment:parent_url url="/blog/categories/whiskey" }}
Outputs: /blog/categories

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages