PageRoutableInterface
in
Interface PageRoutableInterface
Table of Contents
Methods
- active() : bool
- Returns whether or not this page is the currently active page requested via the URL.
- activeChild() : bool
- Returns whether or not this URI's URL contains the URL of the active page.
- canonical() : string
- Returns the canonical URL for a page
- currentPosition() : int|null
- Returns the item in the current position.
- folder() : string|null
- Get/set the folder.
- home() : bool
- Returns whether or not this page is the currently configured home page.
- link() : string
- Gets the URL for a page - alias of url().
- parent() : PageInterface|null
- Gets and Sets the parent object for this page
- path() : string|null
- Gets and sets the path to the folder where the .md for this Page object resides.
- permalink() : string
- Gets the URL with host information, aka Permalink.
- rawRoute() : string
- Gets and Sets the page raw route
- redirect() : string
- Gets the redirect set in the header.
- relativePagePath() : mixed
- Returns the clean path to the page file
- root() : bool
- Returns whether or not this page is the root node of the pages tree.
- routable() : bool
- Gets and Sets whether or not this Page is routable, ie you can reach it via a URL.
- route() : string|null
- Gets the route for the page based on the route headers if available, else from the parents route and the current Page's slug.
- routeAliases() : array<string|int, mixed>
- Gets the route aliases for the page based on page headers.
- routeCanonical() : bool|string
- Gets the canonical route for this page if its set. If provided it will use that value, else if it's `true` it will use the default route.
- topParent() : PageInterface
- Gets the top parent object for this page. Can return page itself.
- unsetRouteSlug() : mixed
- Helper method to clear the route out so it regenerates next time you use it
- url() : string
- Gets the url for the Page.
- urlExtension() : string
- Returns the page extension, got from the page `url_extension` config and falls back to the system config `system.pages.append_url_extension`.
Methods
active()
Returns whether or not this page is the currently active page requested via the URL.
public
active() : bool
Return values
bool —True if it is active
activeChild()
Returns whether or not this URI's URL contains the URL of the active page.
public
activeChild() : bool
Or in other words, is this page's URL in the current URL
Return values
bool —True if active child exists
canonical()
Returns the canonical URL for a page
public
canonical([bool $include_lang = true ]) : string
Parameters
- $include_lang : bool = true
Return values
stringcurrentPosition()
Returns the item in the current position.
public
currentPosition() : int|null
Return values
int|null —The index of the current page.
folder()
Get/set the folder.
public
folder([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
Optional path
Return values
string|nullhome()
Returns whether or not this page is the currently configured home page.
public
home() : bool
Return values
bool —True if it is the homepage
link()
Gets the URL for a page - alias of url().
public
link([bool|null $include_host = false ]) : string
Parameters
- $include_host : bool|null = false
Return values
string —the permalink
parent()
Gets and Sets the parent object for this page
public
parent([PageInterface|null $var = null ]) : PageInterface|null
Parameters
- $var : PageInterface|null = null
-
the parent page object
Return values
PageInterface|null —the parent page object if it exists.
path()
Gets and sets the path to the folder where the .md for this Page object resides.
public
path([string|null $var = null ]) : string|null
This is equivalent to the filePath but without the filename.
Parameters
- $var : string|null = null
-
the path
Return values
string|null —the path
permalink()
Gets the URL with host information, aka Permalink.
public
permalink() : string
Return values
string —The permalink.
rawRoute()
Gets and Sets the page raw route
public
rawRoute([string|null $var = null ]) : string
Parameters
- $var : string|null = null
Return values
stringredirect()
Gets the redirect set in the header.
public
redirect([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
redirect url
Return values
stringrelativePagePath()
Returns the clean path to the page file
public
relativePagePath() : mixed
root()
Returns whether or not this page is the root node of the pages tree.
public
root() : bool
Return values
bool —True if it is the root
routable()
Gets and Sets whether or not this Page is routable, ie you can reach it via a URL.
public
routable([bool|null $var = null ]) : bool
The page must be routable and published
Parameters
- $var : bool|null = null
-
true if the page is routable
Return values
bool —true if the page is routable
route()
Gets the route for the page based on the route headers if available, else from the parents route and the current Page's slug.
public
route([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
Set new default route.
Return values
string|null —The route for the Page.
routeAliases()
Gets the route aliases for the page based on page headers.
public
routeAliases([array<string|int, mixed>|null $var = null ]) : array<string|int, mixed>
Parameters
- $var : array<string|int, mixed>|null = null
-
list of route aliases
Return values
array<string|int, mixed> —The route aliases for the Page.
routeCanonical()
Gets the canonical route for this page if its set. If provided it will use that value, else if it's `true` it will use the default route.
public
routeCanonical([string|null $var = null ]) : bool|string
Parameters
- $var : string|null = null
Return values
bool|stringtopParent()
Gets the top parent object for this page. Can return page itself.
public
topParent() : PageInterface
Return values
PageInterface —The top parent page object.
unsetRouteSlug()
Helper method to clear the route out so it regenerates next time you use it
public
unsetRouteSlug() : mixed
url()
Gets the url for the Page.
public
url([bool $include_host = false ][, bool $canonical = false ][, bool $include_lang = true ][, bool $raw_route = false ]) : string
Parameters
- $include_host : bool = false
-
Defaults false, but true would include http://yourhost.com
- $canonical : bool = false
-
true to return the canonical URL
- $include_lang : bool = true
- $raw_route : bool = false
Return values
string —The url.
urlExtension()
Returns the page extension, got from the page `url_extension` config and falls back to the system config `system.pages.append_url_extension`.
public
urlExtension() : string
Return values
string —The extension of this page. For example .html