Page Variables
In SuCoS, page variables from the front matter allow you to define metadata and properties for individual content Markdown files. They provide a structured way to specify various attributes and settings, enabling you to create dynamic and personalized websites. Let's explore the available front matter properties and their functionalities.
Variables from Front Matter
The page front matter in SuCoS allows you to define metadata and properties for individual content Markdown files. It provides a structured way to specify various attributes and settings. It's super easy to use.
---
Title: My page
Type: blog post
Language: en
---
Content of the page
Below are the available properties and their descriptions:
Title
The title of the content. It represents the main heading or title for the page.
URL
Specifies the URL pattern to be used in creating the content's URL. It allows you to define custom URL structures or placeholders for dynamic URLs.
Type
Represents the type of content. If not specified, it defaults to the value of Section. This property can be used to classify content based on different types, such as blog posts, documentation, or tutorials.
Language
Represents the language of the content. It allows you to specify the language for multilingual sites or for indicating the language used in the content.
Tags
The Tags
property is a list of tags associated with the content. Tags are useful for categorizing and organizing content. They can be used to create tag-based navigation or filtering. In templates, you can iterate over the tags using a liquid for loop to display them.
In addition to the front matter properties, SuCoS also provides calculated page variables that are filled internally and not read from the content front matter. These variables can be utilized in templates for further customization.
<ul>
{% for tag in page.Tags %}
<li><a href="{{ tag.Permalink }}">{{ tag.Title }}</a></li>
{% endfor %}
</ul>
Variables Calculated
These following properties are filled internally by SuCoS itself and not read from the content front matter. It can be used normally in the templates.
Permalink
The permalink represents the URL for the content. It can be used to set a specific URL for the page, overriding the URL pattern.
ContentRaw
The raw content from the Markdown file. It contains the original Markdown text without any modifications.
Lastmod
The Lastmod
variable represents the last modification date of the content.
ExpiryDate
The ExpiryDate
variable indicates the expiration date of the content.
Date
The Date
variable represents the date of the content, typically used for blog posts or time-sensitive content.
Aliases
The Aliases
variable holds a list of alternative URLs that redirect to the content.
Params
The Params
variable is a special property that can absorb any custom variables or values not covered by standard front matter properties. It allows users to define and access their own custom data within the content files.
ContentPreRendered
The pre-rendered Markdown content. It represents the Markdown content that has been parsed and converted to HTML or any other pre-rendered format.
Content
The processed content. It represents the final content that will be rendered on the page. This can include any modifications or additional processing applied to the original Markdown content.
Section
Indicates the directory where the content is located. It provides information about the content's location within the project structure.
Kind
Specifies the type of the page, whether it's a single page, a list of pages, or the home page. This property is useful for determining the page's layout or behavior based on its kind.
Site
It point to the site object and it's general properties. So, from each page, the site configuration can be accessed in the template.
Pages
A collection of other content that mentions this content. Used on list pages like tag or section pages.
The page front matter allows you to customize various aspects of your content, such as the title, URL, tags, and more. These properties can be defined at the beginning of your Markdown file within a YAML block. They enable you to create dynamic and personalized websites using SuCoS SSG.
<h1>{{ page.Title }}</h1>
<span>URL: {{ page.Permalink }}</span>
<span>Date: {{ page.Date }}</span>
Tags:
<ul>
{% for tag in page.Tags %}
<li>{{ tag.Title }}</li>
{% endfor %}
</ul>
<div>
{{ page.Content }}
</div>
RawContent
The RawContent
variable is the markdown content from each file AS-IS, before even being converted to HTML.