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

$builder  : Builder
Builder object.
$config  : Config
Configuration object.
$page  : Page
Page item.

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

$config

Configuration object.

protected Config $config

Methods

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
string

getPath()

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

Return values
string
 
On this page

Search results