back to pages folder structure
If predefined attributes are not enough and you want to add some extra attributes to your page, you can acheive that by using custom attributes section. The name of custom attribute should start with custom
followed by .
. After that you should add at least one character that will represent the name of your attribute.
All attributes can be accessible through global Page
object. That object is accessible from each and every template and it always has a context of current page.
You can access predefined page attributes via Page.Title
, Page.Url
, Page.TemplateId
and Page.Content
for page html content. All properties of global Page
object are case-sensitive.
You can access custom page attributes via properties of Page.Custom
object. It will have all the properties defined in page metadata section.
If your page file looks like this:
url: index.html
template: default.hjs
title: Home
custom.header: header
custom.description: this is my home page
custom.logo.url: http://my.com/logo.png
---
# Welcome to my website!
You can access logo url using the following statement Page.Custom.logo.url
.
There is one important point to highlight here. Page.Custom
is predifened and case-sensitive, but logo.url
was generated dynamicaly from page metadata and it's also case-sensitive.
The main difference between custom attributes and data model is how they interprete the values you provide.
Data
model. It will copy all values from referenced Data
object to current Model
object.Solidify Project is powered by .NET Core 2.0 and distributed under MIT license