Pattern Links
Pattern pages can link to one another with a simplified syntax not requiring exact paths. This is especially useful when generating a static site, as the linking will be preserved on the static site. The basic syntax is:
{{ link.[patternType]-[patternName] }}
For example, say you wanted to link an article page to your homepage. If the article were at 04-pages/articles-/00-top-story.mustache
, you could write:
<a href="{{ link.pages-top-story }}">Article Headline</a>
In the public/patterns
directory, this would be built as:
<a href="../04-pages-articles--00-top-story/04-pages-articles--00-top-story.html">Article Headline</a>
Appending a hyphen (-
) to the "articles" directory is just a recommended convention for static sites. The Static Site Generator flattens nested source directories, but the double-hyphen suggests that "articles" categorizes the more specific parts that follow. The final output of the link would be:
<a href="articles--top-story.html">Article Headline</a>