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

Commit

Permalink
initial trial to custom header for sub-sites (#196)
Browse files Browse the repository at this point in the history
* initial trial to custom header for sub-sites

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

* add static images

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

* add custom header logo in nav-toggle

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

* remove unnecessary in gitignore

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

* Simplify the code, less vars and less duplications

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

* remove unnecessary absURL

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

* move fake logo from static to inside exampleSite

Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>

Co-authored-by: Yi Liu <yi.liu@eclipse-foundation.org>
Co-authored-by: Martin Lowe <martin.lowe@eclipse-foundation.org>
  • Loading branch information
3 people committed Mar 22, 2021
1 parent b9ac59f commit 577a7d2
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,6 +1,8 @@
/node_modules/
/static/*
!/static/js/
/static/images/vendor/
!/static/images/fake_logo/
/static/js/solstice.js
/exampleSite/public
/exampleSite/layouts/robots.txt
Expand Down
6 changes: 6 additions & 0 deletions exampleSite/config/_default/menus.en.toml
Expand Up @@ -53,6 +53,12 @@
weight = 7
parent = "examples"

[[main]]
name = "Subsite Custom Logo"
url = "/subsite-1/"
weight = 8
parent = "examples"

[[main]]
name = "Custom Jumbotron"
url = "/custom-jumbotron/"
Expand Down
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions exampleSite/data/subsites_custom_logo.yml
@@ -0,0 +1,11 @@
items:
-
page_url: '/subsite-1'
logo: '/third-parent/images/fake_logo/jakarta_ee_logo_schooner_color_horizontal_default.png'
logo_url: '/subsite-1'
logo_title: 'subsite-1'
-
page_url: '/third-parent'
logo: '/third-parent/images/fake_logo/jakartaone_livestream_test_white_logo.svg'
logo_url: '/third-parent'
logo_title: 'Third Parent'
17 changes: 15 additions & 2 deletions layouts/partials/nav_toggle.html
Expand Up @@ -22,8 +22,21 @@
{{ 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 }}" />
{{ $currentPageLogo := . }}
{{ $currentPageLogoTitle := $.Site.Title }}
{{ $currentPageLogoLink := "" }}

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

<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>
{{ end }}
</div>
Expand Down
24 changes: 20 additions & 4 deletions layouts/partials/navbar.html
Expand Up @@ -42,11 +42,27 @@
<div class="row" id="header-row">
<div class="{{ $.Site.Params.header_left_classes | default "col-sm-5 col-md-4" }}" id="header-left">
<div class="wrapper-logo-default">
{{- 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 title="{{ $.Site.Title }}" href="{{ "" | absLangURL }}">
<img width="{{ $.Page.Params.logo_width | default $.Site.Params.logo_width | default "140"}}" class="logo-eclipse-default img-responsive hidden-xs" src="{{ . | absURL }}" alt="{{ $.Site.Title }}" />

{{ 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" }}

{{ $currentPageLogo := . }}
{{ $currentPageLogoTitle := $.Site.Title }}
{{ $currentPageLogoLink := "" }}

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

<a title="{{ $currentPageLogoTitle }}" href="{{ $currentPageLogoLink | absLangURL }}">
<img width="{{ $.Page.Params.logo_width | default $.Site.Params.logo_width | default "140"}}" class="logo-eclipse-default img-responsive hidden-xs" src="{{ $currentPageLogo | absURL }}" alt="{{ $currentPageLogoTitle }}" />
</a>
{{ end }}
{{ end }}

</div>
</div>
{{ $has_cfa := 0 }}
Expand Down

0 comments on commit 577a7d2

Please sign in to comment.