add support for creating new sections
This commit is contained in:
parent
c0de0b0e86
commit
24ec6b0d2d
15
README.md
15
README.md
|
@ -78,6 +78,21 @@ Where `:blog-post.md` is the name of the file of your new post.
|
|||
|
||||
The theme supports KaTeX which renders math typesetting in markdown document. Simply turn on by `math: true` in your post.
|
||||
|
||||
### Adding a new section menu
|
||||
|
||||
In your site's `config.toml`, add a new menu definition for say, "photos":
|
||||
```toml
|
||||
# config.toml
|
||||
|
||||
[[menu.main]]
|
||||
identifier = "photos"
|
||||
name = "photos"
|
||||
title = "Photos"
|
||||
url = "/photos"
|
||||
```
|
||||
|
||||
Then, put your posts under "content/photos".
|
||||
|
||||
### Tags
|
||||
|
||||
Right now `hugo-theme-codex` uses the `tags` taxonomy for blog posts. You can view all the blog posts of a given tag by going to `/tags/:tag-name`, where `:tag-name` is the name of your tag.
|
||||
|
|
|
@ -30,15 +30,16 @@ themesDir = "../../"
|
|||
|
||||
# Controls the navigation
|
||||
[[menu.main]]
|
||||
identifier = "about"
|
||||
name = "about"
|
||||
title = "About"
|
||||
url = "/"
|
||||
[[menu.main]]
|
||||
identifier = "blog"
|
||||
name = "blog"
|
||||
title = "Blog"
|
||||
url = "/blog"
|
||||
identifier = "about"
|
||||
name = "about"
|
||||
title = "About"
|
||||
url = "/"
|
||||
|
||||
[[menu.main]]
|
||||
identifier = "blog"
|
||||
name = "blog"
|
||||
title = "Blog"
|
||||
url = "/blog"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<nav class="nav" role="navigation">
|
||||
<ul class="nav__list">
|
||||
{{ $currentPage := . }}
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
<li>
|
||||
<a {{if or ($currentPage.IsMenuCurrent "main" .) (and (eq .Name "blog") (eq $currentPage.Section "blog")) }} class="active"
|
||||
{{end}} href="{{ .URL }}">{{ .Name }}</a>
|
||||
<a {{ if or ($currentPage.IsMenuCurrent "main" .) (eq $currentPage.Section .Identifier) }} class="active"
|
||||
{{end}} href="{{ .URL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue