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

initial trial to custom header for sub-sites #196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,6 +1,8 @@
/node_modules/
/static/*
!/static/js/
/static/images/vendor/
!/static/images/fake_logo/
flora8984461 marked this conversation as resolved.
Show resolved Hide resolved
/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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flora8984461 to confirm, this new logo will be used on sub pages of that section right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, subsite-1, and its children, 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