Active NavElement
This commit is contained in:
parent
39769a89c0
commit
01fa98b28c
@ -36,4 +36,21 @@ a {
|
||||
|
||||
footer {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.nav ul {
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
.nav li>a {
|
||||
color: #555;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav li>a:hover, .nav li.active>a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.nav li.active>a {
|
||||
font-weight: bold;
|
||||
}
|
@ -8,4 +8,4 @@ Meta:
|
||||
|
||||
Lorem ipsum...
|
||||
|
||||
Hier steht dann ne Menge Text. Der kann auch ***formatiert*** _werden_.
|
||||
Hier steht dann ne Menge Text. Der kann auch ***formatiert*** _werden_.
|
||||
|
@ -1,8 +1,8 @@
|
||||
<footer>
|
||||
<footer class="nav">
|
||||
<div><b>service Level 1</b></div>
|
||||
<ul>
|
||||
{{#each NavMap.de.SubMap.service.SubSlice }}
|
||||
<li><a href="{{ GoTo }}">{{ Navname }}</a></li>
|
||||
<li {{#if Active }}class="active"{{/if }}><a href="{{ GoTo }}">{{ Navname }}</a></li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</footer>
|
||||
|
@ -1,14 +1,14 @@
|
||||
<header>
|
||||
<div id="logoDiv"><img src="../assets/img/logo.png"></div>
|
||||
<div id="mainNavDiv">
|
||||
<div id="mainNavDiv" class="nav">
|
||||
<div><b>main Level 1</b></div>
|
||||
<ul>
|
||||
{{#each NavMap.de.SubMap.main.SubSlice }}
|
||||
<li><a href="{{ GoTo }}">{{ Navname }}</a>
|
||||
<li {{#if Active }}class="active"{{/if }}><a href="{{ GoTo }}">{{ Navname }}</a>
|
||||
{{#if SubSlice }}
|
||||
<ul>
|
||||
{{#each SubSlice }}
|
||||
<li><a href="{{ GoTo }}">{{ Navname }}</a></li>
|
||||
<li {{#if Active }}class="active"{{/if }}><a href="{{ GoTo }}">{{ Navname }}</a></li>
|
||||
{{/each }}
|
||||
</ul
|
||||
{{/if }}
|
||||
|
5
main.go
5
main.go
@ -249,6 +249,7 @@ func readContentDir(inBase string, outBase string, dir string, conf *PathConfig,
|
||||
type navElement struct {
|
||||
Navname string
|
||||
GoTo string
|
||||
Active bool
|
||||
|
||||
SubMap *map[string]*navElement
|
||||
SubSlice *[]*navElement
|
||||
@ -256,13 +257,15 @@ type navElement struct {
|
||||
|
||||
func buildNavigation(conf *PathConfigTree, curNavMap *map[string]*navElement, curNavSlice *[]*navElement, activeNav string) {
|
||||
for _, el := range conf.Sub {
|
||||
elPath := strings.TrimPrefix(el.OutputPath, *outDir+"/")
|
||||
|
||||
subMap := make(map[string]*navElement)
|
||||
subSlice := make([]*navElement, 0)
|
||||
navEl := navElement{
|
||||
Active: strings.HasPrefix(activeNav, elPath),
|
||||
SubMap: &subMap,
|
||||
SubSlice: &subSlice,
|
||||
}
|
||||
elPath := strings.TrimPrefix(el.OutputPath, *outDir+"/")
|
||||
|
||||
n := el.Config.This.Navname
|
||||
if n != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user