Page
Page renderer class. This class is responsible for generating the output file path and URL for a page based on the output format properties defined in the configuration. It handles various scenarios such as ugly URLs, multilingual support, and subpaths.
Table of Contents
Properties
Methods
- __construct() : mixed
- getOutputFilePath() : string
- Returns the path of the rendered page, based on the output format properties.
- getPath() : string
- Returns the public path of the page.
Properties
$builder
Builder object.
protected
Builder
$builder
$config
Configuration object.
protected
Config
$config
$page
Page item.
protected
Page
$page
Methods
__construct()
public
__construct(Builder $builder, Page $page) : mixed
Parameters
getOutputFilePath()
Returns the path of the rendered page, based on the output format properties.
public
getOutputFilePath(string $format) : string
Use cases:
- default: path + filename + extension (e.g.: 'blog/post-1/index.html')
- with subpath: path + subpath + filename + extension (e.g.: 'blog/post-1/amp/index.html')
- ugly URL: path + extension (e.g.: '404.html', 'sitemap.xml', 'robots.txt')
- path only (e.g.: '_redirects')
- i18n: language code + default (e.g.: 'fr/blog/page/index.html')
Parameters
- $format : string
-
Output format (ie: 'html', 'amp', 'json', etc.)
Return values
stringgetPath()
Returns the public path of the page.
public
getPath([string $format = 'html' ]) : string
Parameters
- $format : string = 'html'
-
Output format (ie: 'html', 'amp', 'json', etc.), 'html' by default