Skip to content

Commit

Permalink
Moved language selection buttons to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
ilja-radusch committed Mar 24, 2024
1 parent d51638b commit 8832c60
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
26 changes: 26 additions & 0 deletions assets/css/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,32 @@ body {
text-shadow: var(--cover-title-text-shadow);
}

#site-languages {
text-align: right;
margin-bottom: 3rem;
}

.btn-lang {
text-decoration: none;
background-color: var(--highlight);
color: var(--highlight-contrast);
border-radius: 5px;
-webkit-border-radius: 5px;
display: inline-block;
font-size: 70%;
margin: 0 0 0 0.7rem;
padding: 0.3rem 0.7rem;
position: relative;
font-family: "Oswald", sans-serif;
text-transform: uppercase;

&.active,
&:hover {
color: var(--highlight-inverse-contrast);
background-color: var(--highlight-inverse);
}
}

// Landing screen menu
a.btn {
text-decoration: none;
Expand Down
38 changes: 20 additions & 18 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,27 @@
{{- partial "custom_header_video.html" . -}}
{{ end }}

{{ $num_lang := len $languages }}
{{ if and (gt $num_lang 1) $.Site.Params.language_menu }}
<div id="site-languages" class="inner">
{{ range $languages }}
{{ $lang_title := . | strings.ToUpper }}
{{ if .LanguageName }}{{ $lang_title = .LanguageName }}{{ end }}

{{ if eq .Lang $.Lang }}
{{ if $.Site.Params.show_current_lang }}
<span class='btn-lang active'>{{ $lang_title }}</span>
{{ end }}
{{ continue }}
{{ end }}

<a class='btn-lang' href='{{ . | relURL }}'>{{ $lang_title }}</a>
{{ end }}
</div>
{{ end }}

<div id="site-head-content" class="inner">
{{ with .Params.header_logo }}<img id="blog-logo" alt="Logo" src="{{ . | relURL }}" />{{ end }}
{{ with resources.Get .Params.header_logo }}<img id="blog-logo" alt="" src="{{ .RelPermalink }}" />{{ end }}

{{ if .Site.Params.title_guard }}<div class="title-and-description-guard">{{ end }}
{{ with .Params.header_headline }}<h1 class="blog-title">{{ . | safeHTML }}</h1>{{ end }}
Expand All @@ -43,23 +62,6 @@
{{ end }}
{{ end }}

{{ if $.Site.Params.language_menu }}
<div id="site-head-languages" class="inner">
{{ range $languages }}
{{ $selected := "" }}
{{ if eq .Lang $.Lang }}
{{ if not $.Site.Params.show_current_lang }}
{{ continue }}
{{ end }}
{{ $selected = "selected" }}
{{ end }}
{{ $lang_title := . | strings.ToUpper }}
{{ if .LanguageName }}{{ $lang_title = .LanguageName }}{{ end }}
<a class='btn site-menu {{ $selected }}' href='{{ . | relURL }}'>{{ $lang_title }}</a>
{{ end }}
</div>
{{ end }}

{{ with (index $content 0) }}
{{ $first_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $first_title = . }}{{ end }}
<a id='header-arrow' href="#{{- anchorize $first_title -}}" aria-label="Go to first section"><i class="fa fa-angle-down"></i></a>
Expand Down

0 comments on commit 8832c60

Please sign in to comment.