Help:Wiki_Categories
Create a blog tags.
Wiki categories are a way to group wiki pages in a way, users are able to filter for. Our wiki categories currently behave like blog tags. They can produce a list of wiki pages in a category, but are not yet editable. In the future, we plan to extend them to be more like a wiki page, which includes a list of wiki categories. Currently, categories are created on the fly, when they are used. This behavior will not change in the future. Users will only be able to add additional context to them.
Code
Below you find the implementation of the layout.
HTML
Term Page Layout
Defined in layouts/wiki_categories/term.html
.
This code is licensed under the MIT license.
{{/*<!--
Wiki Categories Layout
======================
Contributors: Michael Sasser
Maintainer: Michael Sasser
License: MIT
Version: 1
Type: Term
LAYOUT: /layouts/wiki_categories/tem.html
DOCS: /content/<language>/wiki/Help:Layout_Wiki_Categories.md
STYLE: /assets/scss/layouts/_docs.scss
Description
-----------
The term layout page for the wiki.
Changelog
=========
Version 1
---------
Initial release
-->*/}}
{{ define "main" }}
{{ $wiki := where .Site.RegularPages "Section" "wiki" }}
{{ $wiki_pages := slice }}
<!-- Find the blog posts (pages) -->
{{ range $temp_page := (where $wiki "Params.wiki_categories" "!=" nil) }}
{{ range $t := .Page.Params.wiki_categories }}
{{ if eq (lower $t) (lower $.Title) }}
{{ $wiki_pages = $wiki_pages | append $temp_page }}
{{ end }}
{{ end }}
{{ end }}
<div class="container">
<div class="row flex-xl-nowrap gap-1">
<div class="col-md-12 col-lg-2 col-xl-2 docs-sidebar{{ if ne .Site.Params.options.navbarSticky true }} docs-sidebar-top{{ end }} d-none d-lg-block">
<nav {{ if eq .Site.Params.menu.section.collapsibleSidebar false }}id="sidebar-default" {{ end }}class="docs-links" aria-label="Main navigation">
{{ partial "sidebar/docs-menu.html" . }}
</nav>
</div>
<main class="docs-content col-md-12 col-lg-10 col-xl-10">
<h1 class="pb-4 mb-4">
Category: {{ .Title | title }}
</h1>
{{ $paginator := .Paginate $wiki_pages -}}
{{ range $paginator.Pages -}}
{{ partial "main/wiki-category-list-layout.html" . -}}
{{ end }}
<div class="pagination justify-content-center">
{{ $.Scratch.Set "paginator" true }}
{{ template "_internal/pagination.html" . }}
</div>
</main>
</div>
</div>
{{ end }}
Terms Page Layout
Defined in layouts/wiki_categories/terms.html
.
This code is licensed under the MIT license.
{{/*<!--
Wiki Categories Layout
======================
Contributors: Michael Sasser
Maintainer: Michael Sasser
License: MIT
Version: 1
Type: Terms
LAYOUT: /layouts/wiki_categories/tems.html
DOCS: /content/<language>/wiki/Help:Layout_Wiki_Categories.md
STYLE: /assets/scss/layouts/_docs.scss
Description
-----------
The terms layout page for the wiki.
Changelog
=========
Version 1
---------
Initial release
-->*/}}
{{ define "main" }}
<div class="container">
<div class="row flex-xl-nowrap gap-1">
<div class="col-md-12 col-lg-2 col-xl-2 docs-sidebar{{ if ne .Site.Params.options.navbarSticky true }} docs-sidebar-top{{ end }} d-none d-lg-block">
<nav {{ if eq .Site.Params.menu.section.collapsibleSidebar false }}id="sidebar-default" {{ end }}class="docs-links" aria-label="Main navigation">
{{ partial "sidebar/docs-menu.html" . }}
</nav>
</div>
<main class="docs-content col-md-12 col-lg-10 col-xl-10">
<h1 class="pb-2 mb-2">
Wiki Categories
</h1>
<p class="lead">To find specific topics, page authors have freely defined the categories listed, alphabetically below.</p>
<div class="text-center pb-4 mb-4">{{ .Content }}</div>
{{ $letters := split "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "" }}
<ul class="blog-tags">
{{ range sort .Site.Taxonomies.wiki_categories }}
{{ $firstChar := substr .Page.Title 0 1 | upper }}
<!-- make sure to only have tags where the first char is a letter -->
{{ if $firstChar | in $letters }}
{{ $curLetter := $.Scratch.Get "curLetter" }}
<!-- if $curLetter is nott set or the letter has changed -->
{{ if ne $firstChar $curLetter }}
<!-- end the last ul -->
</ul>
<!-- update the current letter and print it -->
{{ $.Scratch.Set "curLetter" $firstChar }}
<h4 class="text-center">{{ $firstChar }}</h4>
<hr />
<!-- start a new ul -->
<ul class="blog-tags">
{{ end }}
<li>
<a href="{{ .Page.Permalink }}">
<!-- <i class="fa fa-tags"></i> -->
{{ .Page.Title | title }}
<span class="badge text-dark">
{{ .Count }}
</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</main>
</div>
</div>
{{ end }}
Categories | Contributors |
---|---|
Help, Contribute and Layout | Michael Sasser |