Cleans up the code sample

- Invalid markup
- Removed extra unecessary classnames to make example clearer
- Consistent tabbing
This commit is contained in:
Oz Ramos 2018-01-19 00:53:27 -08:00 committed by Bjørn Erik Pedersen
parent c231c9bd57
commit 84622e67c8

View File

@ -27,22 +27,19 @@ The following is an example:
{{< code file="layouts/partials/sidebar.html" download="sidebar.html" >}} {{< code file="layouts/partials/sidebar.html" download="sidebar.html" >}}
<!-- sidebar start --> <!-- sidebar start -->
<aside> <aside>
<div id="sidebar" class="nav-collapse"> <ul>
<!-- sidebar menu start-->
<ul class="sidebar-menu">
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ if .HasChildren }} {{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<li class="sub-menu{{if $currentPage.HasMenuCurrent "main" . }} active{{end}}"> <a href="#">
<a href="javascript:;" class="">
{{ .Pre }} {{ .Pre }}
<span>{{ .Name }}</span> <span>{{ .Name }}</span>
<span class="menu-arrow arrow_carrot-right"></span>
</a> </a>
<ul class="sub"> <ul class="sub-menu">
{{ range .Children }} {{ range .Children }}
<li{{if $currentPage.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.URL}}"> {{ .Name }} </a> </li> <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }} {{ end }}
</ul> </ul>
{{else}} {{else}}
@ -52,15 +49,13 @@ The following is an example:
<span>{{ .Name }}</span> <span>{{ .Name }}</span>
</a> </a>
{{end}} {{end}}
</li>
{{end}} {{end}}
<li> <a href="https://github.com/gohugoio/hugo/issues" target="blank">Questions and Issues</a> </li> <li>
<li> <a href="#" target="blank">Edit this Page</a> </li> <a href="#" target="blank">Hardcoded Link 1</a>
<li>
<a href="#" target="blank">Hardcoded Link 2</a>
</ul> </ul>
<!-- sidebar menu end-->
</div>
</aside> </aside>
<!--sidebar end-->
{{< /code >}} {{< /code >}}
{{% note "`absLangURL` and `relLangURL`" %}} {{% note "`absLangURL` and `relLangURL`" %}}