Skip to content

Commit 78bd9ea

Browse files
committed
Fix the site url.
- Add default url for docs.twinbasic.com - Use JEKYLL_SITE_CONFIG to provide site-specific configuration, e.g. url. This fixes 404 errors on redirect_from pages. If you're hosting this repository for your development purposes, the `url` will not be `https://docs.twinbasic.com`, obviously. But there's no way to override the url from `jekyll build`'s command line. Thus, the `JEKYLL_SITE_CONFIG` site variable (on GitHub's repo configuration), should contain any configuration overrides that take over the default config file. At the very least, that should be `url: https://mysite.github.io`. This will get echoed into a temporary `_site_config.yml`, and passed to `jekyll build`.
1 parent 28f04bf commit 78bd9ea

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/jekyll-gh-pages.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ jobs:
3737
- name: Setup Pages
3838
id: pages
3939
uses: actions/configure-pages@v5
40+
- name: Write secondary config if available
41+
run: |
42+
echo "${{ vars.JEKYLL_SITE_CONFIG }}" > _site_config.yml
43+
echo "SITE_CONFIG=_site_config.yml" >> "$GITHUB_ENV"
44+
if: ${{ vars.JEKYLL_SITE_CONFIG != '' }}
45+
working-directory: ./docs
4046
- name: Build with Jekyll
41-
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
47+
run: bundle exec jekyll build --config _config.yml,$SITE_CONFIG --baseurl "${{ steps.pages.outputs.base_path }}"
4248
working-directory: ./docs
4349
env:
4450
JEKYLL_ENV: production

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: twinBASIC Documentation
22
logo: favicon.png
33
logo_with_title: true
4-
baseurl: /
4+
url: "https://docs.twinbasic.com"
55

66
# note: redcarpet is not supported on github pages
77
markdown: kramdown

0 commit comments

Comments
 (0)