Cecil

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

$config  : Config
Configuration object.

Methods

__construct()  : mixed
getOutputFilePath()  : string
Returns the path of the rendered file, based on the output format properties.
getUrl()  : string
Returns the public URL.

Properties

$config

Configuration object.

protected Config $config

Methods

__construct()

public __construct(Config $config) : mixed
Parameters
$config : Config

getOutputFilePath()

Returns the path of the rendered file, based on the output format properties.

public getOutputFilePath(Page $page, 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
$page : Page
$format : string

Output format (ie: 'html', 'amp', 'json', etc.)

Return values
string

getUrl()

Returns the public URL.

public getUrl(Page $page[, string $format = 'html' ]) : string
Parameters
$page : Page
$format : string = 'html'

Output format (ie: 'html', 'amp', 'json', etc.), 'html' by default

Return values
string
 
On this page

Search results