From 413a86277bb9cbbb7231e2f9dffdd29cefcb25e0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 31 Jan 2021 21:43:23 +0800 Subject: [PATCH] Generate the breadcrumb by Liquid also subtracted '/tabs/' from the tabs path --- 404.html | 9 +++++---- _config.yml | 44 +++++-------------------------------------- _includes/topbar.html | 39 +++++++++++++++++++++++++++++--------- 3 files changed, 40 insertions(+), 52 deletions(-) diff --git a/404.html b/404.html index fd9ff20..d19e5c3 100644 --- a/404.html +++ b/404.html @@ -6,9 +6,6 @@ permalink: /404.html redirect_from: - /norobots/ - /assets/ - - /tabs/ - - /categories/ - - /tags/ - /posts/ dynamic_title: true @@ -16,5 +13,9 @@ dynamic_title: true

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.

-

Head back Home to try finding it again, or search for it on the Archives page.

+

+ Head back Home + to try finding it again, or search for it on the + Archives page. +

diff --git a/_config.yml b/_config.yml index cd56c91..117d01f 100644 --- a/_config.yml +++ b/_config.yml @@ -69,7 +69,6 @@ disqus: # Available options: # # light - Use the light color scheme -# # dark - Use the dark color scheme # theme_mode: # [light|dark] @@ -89,6 +88,9 @@ toc: true paginate: 10 + +# ------------ The following options are not recommended to be modified ------------------ + kramdown: syntax_highlighter: rouge syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options @@ -101,7 +103,7 @@ kramdown: start_line: 1 # DO NOT change this unless you're a Pro user on Jekyll and Web development, -# or you think you're smart enough to change other relevant URLs within this template. +# Or you think you're smart enough to change other relevant URLs within this template. permalink: /posts/:title/ collections: @@ -119,55 +121,19 @@ defaults: layout: post comments: true # Enable comments in posts. toc: true # Display TOC column in posts. - breadcrumb: - - - label: Posts - url: / - scope: path: _drafts values: comments: false - - - scope: - path: index.html - values: - breadcrumb: - - - label: Posts - - - scope: - path: tags - values: - breadcrumb: - - - label: Home - url: / - - - label: Tags - url: /tabs/tags/ - - - scope: - path: categories - values: - breadcrumb: - - - label: Home - url: / - - - label: Categories - url: /tabs/categories/ - scope: path: '' type: tabs # see `site.collections` values: layout: page + permalink: /:title/ dynamic_title: true # Hide title in mobile screens. - breadcrumb: - - - label: Home - url: / sass: style: compressed diff --git a/_includes/topbar.html b/_includes/topbar.html index 1cf82b0..034f984 100644 --- a/_includes/topbar.html +++ b/_includes/topbar.html @@ -5,21 +5,42 @@
- {% for item in page.breadcrumb %} - {% if item.url %} + + {% assign paths = page.url | split: '/' %} + + {% if paths.size == 0 %} + + {{ 'Posts' }} + {% else %} + + {% for item in paths %} + + {% if forloop.first %} + {% unless page.layout == 'post' %} + + {{ 'Home' }} + + {% endunless %} + + {% elsif forloop.last %} + {{ page.title }} + + {% else %} - - {{ item.label }} + {% assign url = item %} + {% if item == 'posts' and page.layout == 'post' %} + {% assign url = '/' %} + {% endif %} + + {{ item | capitalize }} - {% else %} - {{ item.label }} + {% endif %} + {% endfor %} - {% unless page.layout == "home" %} - {{ page.title }} - {% endunless %} + {% endif %}