提交 aae0d53b 编写于 作者: Y Yujia Chen

Optimize language switching in navigation bar

上级 3e82fe90
# home page
[main_home_logo]
other = "/en"
[main_partner_title]
other = "Members"
......
# home page
[main_home_logo]
other = "/zh"
[main_partner_title]
other = "社区会员"
......
<!--h5 -->
<div class="isH5 isPad nav_table">
<a class="navbar-brand home" href="{{ .Site.BaseURL }}">
<a class="navbar-brand home" href="{{ i18n "main_home_logo" }}">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo_small }}" alt="{{ .Title }} logo" class="visible-xs visible-sm">
<span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
......@@ -62,7 +62,7 @@
<div class="container">
<div class="navbar-header">
<a class="navbar-brand home" href="{{ .Site.BaseURL }}">
<a class="navbar-brand home" href="{{ i18n "main_home_logo" }}">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo_small }}" alt="{{ .Title }} logo"
class="visible-xs visible-sm">
......@@ -77,6 +77,8 @@
</div>
</div>
<!--/.navbar-header -->
{{$curURL:= .RelPermalink}}
{{$curDir:= substr $curURL 4}}
<div class="navbar-collapse collapse" id="navigation">
<ul class="nav navbar-nav navbar-right">
{{ $current := . }}
......@@ -89,8 +91,7 @@
{{ end }}
{{ end }}
{{ if ne .Identifier "lang" }}
<li
class="dropdown{{ if eq $current.RelPermalink .URL | or $isChildren | or (eq (trim $current.RelPermalink "/") $topLevel) | or (eq $current.Type .Identifier) | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
<li>
{{ if .HasChildren }}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
......@@ -109,9 +110,33 @@
</li>
{{ end }}
{{ if eq .Identifier "lang" }}
<li style="width:67px;text-align: center;"
class=" dropdown{{ if eq $current.RelPermalink .URL | or $isChildren | or (eq (trim $current.RelPermalink "/") $topLevel) | or (eq $current.Type .Identifier) | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
{{$newLan := .URL}}
{{$newPath := (print $newLan "/" $curDir)}}
{{$splitPath := split $curDir "/"}}
{{$menu := first 1 $splitPath }}
{{$docMenu := first 2 $splitPath }}
{{$finalMenu := index $menu 0}}
{{$finalDocMenu := index $docMenu 1}}
{{if or (eq $finalMenu "blog") (eq $finalMenu "tags") (eq $finalMenu "archives")}}
{{$newPath = (print $newLan "/blog.html")}}
{{end}}
{{if eq $finalMenu "events"}}
{{$newPath = (print $newLan "/events.html")}}
{{end}}
{{if eq $finalDocMenu "20.03_LTS"}}
{{$newPath = (print $newLan "/docs/20.03_LTS/docs/Quickstart/quick-start.html")}}
{{end}}
{{if eq $finalDocMenu "1.0_Base"}}
{{$newPath = (print $newLan "/docs/1.0_Base/docs/Releasenotes/release_notes.html")}}
{{end}}
<li style="width:67px;text-align: center;">
<a href="{{ $newPath }}">{{ .Name }}</a>
</li>
{{ end }}
{{ end }}
......@@ -122,9 +147,7 @@
<li><a href="https://gitee.com/src-openeuler">{{i18n "main_nav_packageSources"}}</a></li>
</ul>
</li>
</li>
</ul>
</div>
<!--/.nav-collapse -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册