When I click on the tags on the right of my Github pages, it always give me a 404 page. However, when I preview it locally, the redirect seem to work just fine:
I wonder if it has something to do with my _config.yml
. I have tried different url and baseurl strings, but still couldn't resolve it.
(Note: This theme was adopted from Chirpy)
Thanks!
Part of my config.yml
:
title: Changyu Yan
url: 'https://changyuyan.github.io'
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
timezone: America/Los_Angeles
google_analytics:
id: ''
pv:
# The Google Analytics pageviews switch.
# DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
enabled: false
# the next options only valid when `google_analytics.pv` is enabled.
proxy_url: ''
proxy_endpoint: ''
cache: false # pv data local cache, good for the users from GFW area.
# boolean type, the global switch for ToC in posts.
toc: true
paginate: 10
kramdown:
syntax_highlighter: rouge
syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options
css_class: highlight
# default_lang: console
span:
line_numbers: false
block:
line_numbers: true
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.
permalink: /posts/:title/
collections:
tabs:
output: true
sort_by: order
defaults:
-
scope:
path: '' # An empty string here means all files in the project
type: posts
values:
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
dynamic_title: true # Hide title in mobile screens.
breadcrumb:
-
label: Home
url: /
sass:
sass_dir: /assets/css
style: compressed
compress_html:
clippings: all
comments: all
endings: all
profile: false
blanklines: false
ignore:
envs: []
exclude:
- vendor
- Gemfile.lock
- Gemfile
- tools
- docs
- README.md
- LICENSE
jekyll-archives:
enabled: [categories, tags]
layouts:
category: category
tag: tag
permalinks:
tag: /tags/:name/
category: /categories/:name/
The archives are working locally and not on GitHub Pages because the jekyll-archives gem is not supported in GitHub Pages. You can see in the notes for Chirpy, under Deploy on GitHub Pages, an option for using GitHub Actions. This should allow you to run unsupported plugins (there is a good tutorial by Aneejian).
Another option is to manually build all your tag pages. You would need to create a tag
directory and inside that, create all the tag files (software-engineering.html). Inside those you'd run a for
loop for that tag. You have a couple of options:
{% for post in site.tags.software-engineering %}
or
{% for post in site.posts | where: 'tag', 'software-engineering' %}
There are others that may better suit your use-case.
Per the baseurl
discussion, you do not need that if you do not use a project directory. If you wanted https://changyuyan.github.io/blog/tags/software-engineering/, you'd need to add baseurl: '/blog
...but it doesn't look like you want that.