Skip to content

Commit

Permalink
Add the ability to add sections in the right side (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateimicu authored and ribice committed May 14, 2018
1 parent e716e5f commit c934577
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ To align images, add #c for center, #r/l for right/left.
![](/img/1/image.jpg#c)
```

## Add sections
Links can be added to the navbar (bellow the blog name and social links).
There are two positions:


- `[params.sections_left]` that will add links in the left side (under the blog title)
- `[params.sections_right]` that will add links in the right side (under the social links)

```toml
[params.sections_left]
"/special-page" = "Special page"
"https://example.com" = "Example"

[params.sections_right]
"http://example.com/special-page" = "Example"
```

## Related Articles

To include related articles in the bottom of the content, set params.info.related to true.
Expand Down Expand Up @@ -129,4 +146,4 @@ The following resources are included in the theme:

## Author

[Emir Ribic](https://github.com/ribice)
[Emir Ribic](https://github.com/ribice)
23 changes: 18 additions & 5 deletions layouts/partials/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,31 @@
</div>
</nav>

{{ if (isset .Site.Params "sections" ) }}
<nav class="nav">
<nav class="nav">
{{ if (isset .Site.Params "sections_left" ) }}
<div class="nav-left">
{{- range $section, $printable := .Site.Params.sections -}}
{{- range $section, $printable := .Site.Params.sections_left -}}
{{- if $printable -}}
<a class="nav-item" href="{{$section}}">
<h2 class="title is-5">{{$printable}}</h2>
</a>
{{- end -}}
{{- end -}}
</div>
</nav>
{{ end }}
{{ end }}

{{ if (isset .Site.Params "sections_right" ) }}
<div class="nav-right">
{{- range $section, $printable := .Site.Params.sections_right -}}
{{- if $printable -}}
<a class="nav-item" href="{{$section}}">
<h2 class="title is-5">{{$printable}}</h2>
</a>
{{- end -}}
{{- end -}}
</div>
{{ end }}
</nav>

</div>
</section>

0 comments on commit c934577

Please sign in to comment.