grow / grow

A declarative website generator designed for high-quality websites, with a focus on easy maintenance and localization.

Home Page:https://grow.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

slug management

jaygray0919 opened this issue · comments

we would like to use a fixed length (20 digit) identifier as a slug.
the identifier is structured, representing position in a tree and data type.

our reasoning:

  • we serve international markets and use portable object files for natural language (NL) text.
  • we do not want English terms in a URL; it's presumptuous that a non-English reader will understand such terms

in front matter we use:

  • $title@
  • description
  • $localization + path (to link buildable content)

we have a breadcrumb.j2 template that presents the logical position of a page in a tree.
breadcrumbs are generated from front matter and presented in an NL (using PO entries) on a page.

here is my question:
in front matter, how to set all labels, text and path directives (per above) *and* specify a 20-digit-identifier as a slug?

here is an example (targeted but not yet enabled in our Grow environment)
https://ontomatica.io/a/12370110501010001961/

this slug:
12370110501010001961
is generated according to our internal content management system.

the final two digits identify the NL

  • 61 is en-US
  • 38 is german

in summary, we use Grow front matter as prescribed to generate NL pages.
but we do not see how to add the additional identifier in front matter to generate a URL slug using a 20-digit-identifier.

would you tell us to accomplish the above, and point to documentation that we may be missing, or not understanding?

thanks
/jay

Hi Jay,

When your plugin generates the document files based on the CMS data, when generating the filename, simply output the 20 digit identifier to the filename in full. In other words, the filename should be output as 12370110501010001961.md in your example, with the _blueprint.yaml containing:

$path: /a/{base}/

Per https://grow.dev/reference/urls/#content-document-path-formatters