Page Layouts

Build pages with a landing page, blog, or documentation layout. Add custom sections and components to suit your needs.

On this page

Default structure

See also: ./layouts/_default/baseof.html

Sections

Landing page layout

See also the Bootstrap documentation: Layout

Components

See the Bootstrap documentation: Components

Landing page

The homepage and 404 page have a landing page layout.

Example

./layouts/index.html excerpt:

  1. {{ define "sidebar-prefooter" }}
  2. <section class="section section-sm">
  3. <div class="container">
  4. <div class="row justify-content-center text-center mt-lg-3">
  5. <div class="col-lg-5">
  6. <h2 class="h4">Full text search</h2>
  7. <p>Search your Doks site with FlexSearch. Easily customize index settings and search options to your liking.</p>
  8. </div>
  9. <div class="col-lg-5">
  10. <h2 class="h4">Page layouts</h2>
  11. <p>Build pages with a landing page, blog, or documentation layout. Add custom sections and components to suit your needs.</p>
  12. </div>
  13. <div class="col-lg-5">
  14. <h2 class="h4">Dark mode</h2>
  15. <p>Switch to a low-light UI with the click of a button. Change colors with variables to match your branding.</p>
  16. </div>
  17. </div>
  18. </div>
  19. </section>
  20. {{ end }}

Alert homepage

The homepage contains an alert component.

👉

Set alert and alertText in ./config/_default/params.toml.

Blog page

Example

./layouts/blog/single.html:

  1. {{ define "main" }}
  2. <div class="row justify-content-center">
  3. <div class="col-md-12 col-lg-10 col-xl-8">
  4. <article>
  5. <div class="blog-header">
  6. <h1>{{ .Title }}</h1>
  7. {{ partial "main/blog-meta.html" . }}
  8. </div>
  9. <p class="lead">{{ .Params.lead | safeHTML }}</p>
  10. {{ .Content }}
  11. </article>
  12. </div>
  13. </div>
  14. {{ end }}

Documentation page

Example

./layouts/docs/single.html:

  1. {{ define "main" }}
  2. <div class="row flex-xl-nowrap">
  3. <div class="col-lg-5 col-xl-4 docs-sidebar">
  4. <nav class="docs-links" aria-label="Main navigation">
  5. {{ partial "sidebar/docs-menu.html" . }}
  6. </nav>
  7. </div>
  8. {{ if ne .Params.toc false -}}
  9. <nav class="docs-toc d-none d-xl-block col-xl-3" aria-label="Secondary navigation">
  10. {{ partial "sidebar/docs-toc.html" . }}
  11. </nav>
  12. {{ end -}}
  13. {{ if .Params.toc -}}
  14. <main class="docs-content col-lg-11 col-xl-9">
  15. {{ else -}}
  16. <main class="docs-content col-lg-11 col-xl-9 mx-xl-auto">
  17. {{ end -}}
  18. <h1>{{ .Title }}</h1>
  19. <p class="lead">{{ .Params.lead | safeHTML }}</p>
  20. {{ partial "main/headline-hash.html" .Content }}
  21. {{ if .Site.Params.editPage -}}
  22. {{ partial "main/edit-page.html" . }}
  23. {{ end -}}
  24. {{ partial "main/docs-navigation.html" . }}
  25. </main>
  26. </div>
  27. {{ end }}

main

The main section contains an Edit this page on GitHub link.

👉

Set editPage and docsRepo in ./config/_default/params.toml.

toc

A table of contents — the On this page section — is automatically generated from the headings of the main section of a page.

💡

Disable the toc by setting it to false in the front matter of a page.

nav

See also: Menus.