Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jsnjack/kraiklyn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYauhen Shulitski <jsnjack@gmail.com>2018-01-27 18:58:07 +0300
committerYauhen Shulitski <jsnjack@gmail.com>2018-01-27 18:59:12 +0300
commite6da1b8ac02bd7d487a20e770defbcd62d7ea67c (patch)
treeb45110e0932a7837ed99652967ae8614f5738c25
parent811c277eca5686278a2dbdfe16a26165c7e9ed7e (diff)
Support infinite inheritance
-rw-r--r--layouts/index.html7
-rw-r--r--layouts/partials/menu.html7
-rw-r--r--layouts/partials/menu_page_list.html20
-rw-r--r--layouts/partials/section_list.html14
-rw-r--r--layouts/partials/sidebar.html17
5 files changed, 43 insertions, 22 deletions
diff --git a/layouts/index.html b/layouts/index.html
index efa8394..d0e5840 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -3,12 +3,7 @@
<div class="content">
{{ with .Sections }}
{{ range .ByWeight }}
- {{ partial "section.html" . }}
- {{ if .Pages }}
- {{ range .Pages.ByWeight }}
- {{ partial "section.html" . }}
- {{ end }}
- {{ end }}
+ {{ partial "section_list.html" . }}
{{ end }}
{{ end }}
</div>
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
new file mode 100644
index 0000000..fefd79c
--- /dev/null
+++ b/layouts/partials/menu.html
@@ -0,0 +1,7 @@
+<ul>
+ {{ with .Sections }}
+ {{ range .ByWeight }}
+ {{ partial "menu_page_list.html" . }}
+ {{ end }}
+ {{ end }}
+</ul>
diff --git a/layouts/partials/menu_page_list.html b/layouts/partials/menu_page_list.html
new file mode 100644
index 0000000..8a6b57b
--- /dev/null
+++ b/layouts/partials/menu_page_list.html
@@ -0,0 +1,20 @@
+{{ if .Pages }}
+ <li>
+ <a href="#{{ .Params.anchor }}">{{ .Title }}</a>
+ <ul>
+ {{ if .Sections }}
+ {{ range .Sections.ByWeight }}
+ {{ partial "menu_page_list.html" . }}
+ {{ end }}
+ {{ end }}
+ {{ range .Pages.ByWeight }}
+ <li><a href="#{{ .Params.anchor }}">{{ .Title }}</a></li>
+ {{ end }}
+ </ul>
+ </li>
+{{ else }}
+ <li>
+ <a href="#{{ .Params.anchor }}">{{ .Title }}</a>
+ </li>
+{{ end }}
+
diff --git a/layouts/partials/section_list.html b/layouts/partials/section_list.html
new file mode 100644
index 0000000..14dd435
--- /dev/null
+++ b/layouts/partials/section_list.html
@@ -0,0 +1,14 @@
+{{ if .Pages }}
+ {{ partial "section.html" . }}
+ {{ if .Sections }}
+ {{ range .Sections.ByWeight }}
+ {{ partial "section_list.html" . }}
+ {{ end }}
+ {{ end }}
+ {{ range .Pages.ByWeight }}
+ {{ partial "section.html" . }}
+ {{ end }}
+{{ else }}
+ {{ partial "section.html" . }}
+{{ end }}
+
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 7746744..20c7029 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -2,22 +2,7 @@
{{ partial "logo.html" }}
<h1 class="site-title"><a href="/">{{ .Site.Title }}</a></h1>
<nav class="internal">
- <ul>
- {{ with .Sections }}
- {{ range .ByWeight }}
- <li>
- <li><a href="#{{ .Params.anchor }}">{{ .Title }}</a></li>
- </li>
- {{ if .Pages }}
- <ul>
- {{ range .Pages.ByWeight }}
- <li><a href="#{{ .Params.anchor }}">{{ .Title }}</a></li>
- {{ end }}
- </ul>
- {{ end }}
- {{ end }}
- {{ end }}
- </ul>
+ {{ partial "menu.html" . }}
</nav>
<nav class="external">
{{ with .Site.Menus.shortcuts }}