Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Commit

Permalink
add custom header logo in nav-toggle
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
  • Loading branch information
Yi Liu committed Jan 19, 2021
1 parent db31e12 commit 514ade5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
9 changes: 9 additions & 0 deletions exampleSite/content/subsite-1/_index.md
@@ -0,0 +1,9 @@
---
title: "SubSite"
headline: "SubSite"
date: 2018-04-05T16:09:45-04:00
description: "SubSite"
hide_sidebar: false
---

SubSite
8 changes: 8 additions & 0 deletions exampleSite/content/subsite-1/subsite-child-1/_index.md
@@ -0,0 +1,8 @@
---
title: "SubSite-Child 1"
date: 2018-04-05T16:09:45-04:00
description: "SubSite-Child 1"
hide_sidebar: false
---

SubSite-Child 1
6 changes: 3 additions & 3 deletions exampleSite/data/subsites_custom_logo.yml
@@ -1,9 +1,9 @@
items:
-
page_url: '/components'
page_url: '/subsite-1'
logo: '/images/fake_logo/jakarta_ee_logo_schooner_color_horizontal_default.png'
logo_url: '/components'
logo_title: 'Components'
logo_url: '/subsite-1'
logo_title: 'subsite-1'
-
page_url: '/third-parent'
logo: '/images/fake_logo/jakartaone_livestream_test_white_logo.svg'
Expand Down
29 changes: 26 additions & 3 deletions layouts/partials/nav_toggle.html
Expand Up @@ -21,10 +21,33 @@
</button>
{{ end }}
<div class="wrapper-logo-mobile">
{{- with .Page.Params.logo | default .Site.Params.logo | default "https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white-orange.svg" }}
<a class="navbar-brand visible-xs" title="{{ $.Site.Title }}" href="{{ "" | absLangURL }}">
<img width="{{ $.Page.Params.logo_width | default $.Site.Params.logo_width | default "140"}}" class="logo-eclipse-default-mobile img-responsive" src="{{ . | absURL }}" alt="{{ $.Site.Title }}" />

{{ $flag := false }}
{{ $currentPageLogo := '0' }}
{{ $currentPageLogoTitle := '0' }}
{{ $currentPageLogoLink := '0' }}
{{ range $.Site.Data.subsites_custom_logo.items }}

{{ $section := $.Site.GetPage (.page_url) }}
{{ if or (eq ($.Section) ($section)) ( $.Page.IsDescendant $section ) }}
{{ $flag = true }}
{{ $currentPageLogo = .logo }}
{{ $currentPageLogoTitle = .logo_title }}
{{ $currentPageLogoLink = .logo_url }}
{{ end }}
{{ end }}

{{ if and (eq $flag true) (ne $currentPageLogo '0') }}
<a class="navbar-brand visible-xs" title="{{ $currentPageLogoTitle }}" href="{{ $currentPageLogoLink | absLangURL }}">
<img width="{{ $.Page.Params.logo_width | default $.Site.Params.logo_width | default "140"}}" class="logo-eclipse-default-mobile img-responsive" src="{{ $currentPageLogo | absURL }}" alt="{{ $currentPageLogoTitle }}" />
</a>

{{ else }}
{{- with .Page.Params.logo | default .Site.Params.logo | default "https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white-orange.svg" }}
<a class="navbar-brand visible-xs" title="{{ $.Site.Title }}" href="{{ "" | absLangURL }}">
<img width="{{ $.Page.Params.logo_width | default $.Site.Params.logo_width | default "140"}}" class="logo-eclipse-default-mobile img-responsive" src="{{ . | absURL }}" alt="{{ $.Site.Title }}" />
</a>
{{ end }}
{{ end }}
</div>
</div>

0 comments on commit 514ade5

Please sign in to comment.