diff --git a/README.md b/README.md index b8bbd0f6..0f3fd1e4 100644 --- a/README.md +++ b/README.md @@ -935,6 +935,8 @@ Body: None. ### Include +Files can be included in many places in HTML. + | If this file exists | It is included at | | ---------------------------------------------------------| -------------------------------------| | `yoursite/layouts/partials/paige/body-first.html` | The beginning of the body tag | @@ -954,6 +956,22 @@ Body: None. | `yoursite/layouts/partials/paige/style-first.css` | The beginning of the style tag | | `yoursite/layouts/partials/paige/style-last.css` | The end of the style tag | +There are kind variants of include files that are included only when the file kind matches the page kind. + +| If this file exists | It is included when | +| --------------------------------------------------------| ----------------------------| +| `yoursite/layouts/partials/paige/[PLACE]-home.html` | The page kind is "home" | +| `yoursite/layouts/partials/paige/[PLACE]-page.html` | The page kind is "page" | +| `yoursite/layouts/partials/paige/[PLACE]-section.html` | The page kind is "section" | +| `yoursite/layouts/partials/paige/[PLACE]-taxonomy.html` | The page kind is "taxonomy" | +| `yoursite/layouts/partials/paige/[PLACE]-term.html` | The page kind is "term" | + +Above, the place placeholder must be "body-first", "body-last", "head-first", etc. + +Kind variants are included right after their counterpart non-kind variant. + +The argument for the templates is the page. + ### Override Most code is in partial templates that the layout templates use. diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 47eb5819..adc69ce3 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -14,32 +14,21 @@ {{ partial "paige/tag-head.html" $page }} {{ partial "paige/tag-body.html" $page }} - {{ if templates.Exists "partials/paige/body-first.html" }} - {{ partial "paige/body-first.html" $page }} - {{ end }} + {{ partial "paige/func-include.html" (dict "name" "body-first%s.html" "page" $page) }}