Skip to content

Commit

Permalink
feat: support parent brand config
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Mar 23, 2023
1 parent 9d8ef12 commit b6d7b58
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/jekyll/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ feed:

# KnoSys site config
ksio:
brand:
parent:
text: OOSS
url: https://oss.ourai.ws/
navs:
- text: 指南
url: /guides/
Expand Down
6 changes: 5 additions & 1 deletion src/jekyll/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<span class="icon-bar"></span>
</button>
{% endif %}
<a href="{{ '/' | prepend: site.baseurl | prepend: site.url }}" class="navbar-brand">{{ site.title }}</a>
{% if site.ksio.brand.parent %}
<div class="navbar-brand">{% include partials/brand-link.html %}</div>
{% else %}
{% include partials/brand-link.html class="navbar-brand" %}
{% endif %}
</div>
<!-- Nav menus -->
<nav class="Page-navs navbar-collapse collapse">
Expand Down
8 changes: 8 additions & 0 deletions src/jekyll/_includes/partials/brand-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% assign _inc_parent_brand = site.ksio.brand.parent %}
{% assign _inc_brand_url = '/' | prepend: site.baseurl | prepend: site.url %}
{% assign _inc_brand_text = site.ksio.brand.text | default: site.title %}
{% if _inc_parent_brand %}
<a href="{{ _inc_parent_brand.url }}?utm_source=ourai.github.io/lime&utm_medium=brand" target="_blank" rel="external ">{{ _inc_parent_brand.text }}</a><a href="{{ _inc_brand_url }}">{{ _inc_brand_text }}</a>
{% else %}
<a {% if include.class %}class="{{ include.class }}" {% endif %}href="{{ _inc_brand_url }}">{{ _inc_brand_text }}</a>
{% endif %}
6 changes: 2 additions & 4 deletions src/jekyll/_layouts/guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

{% if repo and repo.toc %}
<aside class="Page-aside">
<div class="AsideBrand"><a href="{{ '/' | prepend: site.baseurl | prepend: site.url }}" title="回到首页">{{ site.title }}</a></div>
<nav class="AsideNav">
{% include doc-toc.html repo=page.repo items=repo.toc collection=repo.collection %}
</nav>
<div class="AsideBrand">{% include partials/brand-link.html %}</div>
<nav class="AsideNav">{% include doc-toc.html repo=page.repo items=repo.toc collection=repo.collection %}</nav>
</aside>
{% endif %}
<main class="Page-main">
Expand Down

0 comments on commit b6d7b58

Please sign in to comment.