You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The metas plugin has the defaultPageData option to configure default values for the metas properties. I think this is not convenient due two reasons:
It cannot be configured per page because it's defined in the _config.ts file
If some defaults values are defined in a _data file (for example, metas.title), then you need to do metas.title = null to use the default value configured.
I propose to change the plugin to implement a syntax to define aliases to existing variables. For example:
title: Hello worlddescription: This is my sitemetas:
title: $titledescription: $description
Any value starting with $ sign would be interpreted as an alias to an existing value (in the example above, title and description. It could allow also values like $header.title.
This allows to have different defaults for different types of pages, using _data files in subfolders.
Edit:
Maybe the sign ~ is better, because it's what's used by the url plugin to refer to source files (like ~/about-me.md):
title: Hello worlddescription: This is my sitemetas:
title: ~titledescription: ~description
Other alternative syntaxes:
title: Hello worlddescription: This is my sitemetas:
title: &titledescription: &description
(Cons: The & sign is a thing in Yaml).
title: Hello worlddescription: This is my sitemetas:
title: {{ title }}description: {{ description }}
(Const: It looks like nunjucks, people may think it's possible to use filters and other nunjucks features).
Any feedback is welcome!
The text was updated successfully, but these errors were encountered:
Enter your suggestions in details:
The
metas
plugin has thedefaultPageData
option to configure default values for themetas
properties. I think this is not convenient due two reasons:_config.ts
file_data
file (for example,metas.title
), then you need to dometas.title = null
to use the default value configured.I propose to change the plugin to implement a syntax to define aliases to existing variables. For example:
Any value starting with
$
sign would be interpreted as an alias to an existing value (in the example above,title
anddescription
. It could allow also values like$header.title
.This allows to have different defaults for different types of pages, using
_data
files in subfolders.Edit:
Maybe the sign
~
is better, because it's what's used by theurl
plugin to refer to source files (like~/about-me.md
):Other alternative syntaxes:
(Cons: The
&
sign is a thing in Yaml).(Const: It looks like nunjucks, people may think it's possible to use filters and other nunjucks features).
Any feedback is welcome!
The text was updated successfully, but these errors were encountered: