Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(platenioGH-35) Implement the getCssClass shortcode
This commit implements a helper shortcode, `getCssClass` to be used in our patch on the `_default/baseof.html` template to retrieve the class or classes which should be injected into the `body` of a page. It defaults to returning an empty string. In this implementation, If the page is a member of a top-level docs section (`docs` by default, but can be configured to `games` or anything else via the `Params.BookSection` parameter in the site config), such as `content/docs/my_game/rules.md` or `content/games/my_game/rules.md`, then: 1. If the `_index.md` for that section does **not** define `cssClass` in its frontmatter, then the default CSS class injected for that section is the URL segment for that section; in this example, `my_game`. 2. If the `_index.md` for that section **does** define `cssClass` in its frontmatter, then the CSS class injected for that section is the value of that parameter. This can be used to inject multiple classes, each of them separated by a single space. In this current implementation, other top-level pages and sub-sections of a given section may not override or append their own class injections.
- Loading branch information