path_handler.meta_info

SummaryProvides the ability to set meta information for any path or node
Short namemeta_info
Path patterns/**/metainfo, /**/*.metainfo
Provided by bundlebuilt-in
API docWebgen::PathHandler::MetaInfo

Description

This path handler provides the ability to set meta information for any path before node creation and/or for any node after its creation. It uses paths in Webgen Page Format.

webgen handles meta information paths before any other paths so that the meta information can correctly be applied!

Usage

As stated above the format for a meta information path is the Webgen Page Format and such a path may contain two blocks:

paths
This block specifies meta information for paths and therefore this meta information is applied before nodes for a path are created. This can be used, for example, to change the destination path via the  dest_path meta information or to ignore paths using the  draft meta information.

When specifying path patterns, remember that the patterns are matched against the source paths!

Note that if a meta information path is created programmatically during a webgen run, meta information from this section is not applied retro-actively to paths!

alcn
This block specifies meta information for nodes and this meta information is applied to nodes directly after their creation.

When specifying patterns, remember that the patterns are matched against absolute localized canonical names! So you always need to take the language part into account, i.e. /index.html won’t match but /index.en.html will.

The block names must be explicitly specified, i.e. on the block starting line.

The format of the two blocks is the same: They need to contain a valid YAML hash with path patterns as keys and the to-be-assigned meta information as values.

The path patterns may either be absolute (i.e. starting with a slash) or relative. In the latter case the patterns are prefixed with the directory part of the source path to get an absolute path pattern.

If more than one path pattern matches a path or a node alcn, the order is important. webgen sorts all meta info paths by path name first, so /default.metainfo comes before /metainfo for example. The order of the key:value definitions inside a meta information path is also preserved.

Example

Here is an example for the content of a meta information path:

--- paths
/**/*.page:
  blocks: {defaults: {pipeline: [erb,kramdown,blocks,fragments]}}

/blog/2013/**/*.page:
  draft: true

--- alcn
**/index.en.html:
  in_menu: true
  • In the ‘paths’ block all page paths are assigned a new default pipeline. This could also be done in the ‘alcn’ block.

  • The  draft meta information is also set for some page paths in the ‘paths’ block. Since this meta information needs to be present before a node gets created, it only makes sense to specify here.

  • In the ‘alcn’ block some nodes get the ‘in_menu’ meta information assigned. Note that use of the language part in the pattern since the pattern is matched against alcns. Also note that the pattern does not start with a slash and therefore is taken relative to the directory in which the meta information source path is in.