mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 05:41:31 +00:00
Use collections to improve the tabs
This commit is contained in:
@@ -12,20 +12,21 @@
|
||||
|
||||
{% elsif page.layout == 'page' %}
|
||||
|
||||
{% if page.type == 'categories' %}
|
||||
{% if page.collection == 'tabs' and page.title != 'About' %}
|
||||
|
||||
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
|
||||
|
||||
{% elsif page.type == 'tags' %}
|
||||
|
||||
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
|
||||
|
||||
{% elsif page.type == 'archives' %}
|
||||
|
||||
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
|
||||
{% if page.title == 'Categories' %}
|
||||
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
|
||||
|
||||
{% elsif page.title == 'Tags' %}
|
||||
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
|
||||
|
||||
{% elsif page.title == 'Archives'%}
|
||||
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
{% elsif page.layout == 'page' %}
|
||||
|
||||
{% if page.type == 'categories' %}
|
||||
{% if page.title == 'Categories' and page.collection == 'tabs' %}
|
||||
<script async src="{{ '/assets/js/categories.min.js' | relative_url }}"></script>
|
||||
{% else %}
|
||||
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
-->
|
||||
|
||||
<div id="nav-wrapper">
|
||||
|
||||
<div id="profile-wrapper" class="d-flex flex-column">
|
||||
<div id="avatar" class="d-flex justify-content-center">
|
||||
<a href="{{ site.baseurl }}/" alt="avatar">
|
||||
@@ -25,31 +26,25 @@
|
||||
</div>
|
||||
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- #profile-wrapper -->
|
||||
|
||||
<ul class="nav flex-column">
|
||||
{% assign page_urls = page.url | split: "/" %}
|
||||
|
||||
{% for item in site.data.tabs %}
|
||||
{% assign ref = site.baseurl | append: "/" %}
|
||||
|
||||
{% if item.path %}
|
||||
{% assign ref = ref | append: item.path | append: "/" %}
|
||||
{% if item.url %}
|
||||
{% assign ref = ref | append: item.url | append: "/" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item d-flex justify-content-center
|
||||
{% if item.url == page_urls.last
|
||||
or item.name == page.tab_active
|
||||
or item.name == "Home" and page.layout == "home" %}active{% endif %}">
|
||||
<a href="{{ ref }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<i class="fa-fw {{ item.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ item.name | upcase }}</span>
|
||||
<!-- home -->
|
||||
<li class="nav-item d-flex justify-content-center {% if page.layout == 'home' %}active{% endif %}">
|
||||
<a href="/" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ "HOME" }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- the real tabs -->
|
||||
{% for tab in site.tabs %}
|
||||
<li class="nav-item d-flex justify-content-center {% if tab.url == page.url %}active{% endif %}">
|
||||
<a href="{{ tab.url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ tab.title | upcase }}</span>
|
||||
</a>
|
||||
</li> <!-- .nav-item -->
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
</ul> <!-- ul.nav.flex-column -->
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
<i id="sidebar-trigger" class="fas fa-bars fa-fw"></i>
|
||||
|
||||
<div id="topbar-title">
|
||||
{% if page.location %}
|
||||
{{- page.location -}}
|
||||
{% elsif page.layout == "home" %}
|
||||
{{- site.title -}}
|
||||
{% else %}
|
||||
{{- page.title -}}
|
||||
{% endif %}
|
||||
{% if page.layout == 'home' %}
|
||||
{{- site.title -}}
|
||||
{% elsif page.collection == 'tabs' %}
|
||||
{{- page.title -}}
|
||||
{% else %}
|
||||
{{- page.layout | capitalize -}}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<i id="search-trigger" class="fas fa-search fa-fw"></i>
|
||||
|
||||
Reference in New Issue
Block a user