diff options
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | layouts/partials/sidebar.html | 33 |
2 files changed, 49 insertions, 0 deletions
@@ -20,4 +20,20 @@ theme = 'ed' description = 'Ed is a Hugo theme designed for textual editors based on minimal computing principles, and focused on legibility and flexibility.' # Color scheme. Options: red, orange, magenta, cyan, blue, brown color_scheme = '' + # Github project url. Used in sidebar + github_url = 'https://github.com/user/project' + +[menu] + [[menu.nav]] + name = "Home" + url = "/" + weight = 1 + [[menu.nav]] + name = "Posts" + url = "/posts/" + weight = 2 + [[menu.nav]] + name = "Tags" + url = "/tags/" + weight = 3 ``` diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index e69de29..c4a3220 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -0,0 +1,33 @@ +{{- /* Target for toggling the sidebar `.sidebar-checkbox` is for regular styles, `#sidebar-checkbox` for behavior. */ -}} +<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> + +<!-- Toggleable sidebar --> +<aside class="sidebar" id="sidebar"> + <div class="sidebar-item"> + <p>{{- .Site.Params.Description -}}</p> + </div> + + <nav class="sidebar-nav"> + <a class="sidebar-nav-item{{- if .IsHome }} active{{ end -}}" href="{{ .Site.BaseURL }}">Home</a> + + {{- $current := . }} + {{- /* TODO: Render items dynamically */}} + {{- range .Site.Menus.nav }} + {{- $active := or ($current.IsMenuCurrent "nav" .) ($current.HasMenuCurrent "nav" .) }} + {{- $active = or $active (eq .Name $current.Title) }} + <a class="sidebar-nav-item {{ if $active }}active{{ end }}" href="{{ .URL }}"> + {{- $text := print .Name | safeHTML -}} + {{- $text -}} + </a> + {{- end -}} + {{/* TODO: Add hypothesis support */}} + <a class="sidebar-nav-item" href="{{ .Site.Params.github_url }}" target="_blank">GitHub project</a> + </nav> + + <div class="sidebar-item"> + <p> + Built with <a href="https://github.com/sergeyklay/gohugo-theme-ed" target="_blank">Ed.</a> + Distributed under an MIT license. + </p> + </div> +</aside> |
