Skip to content

Commit 18dff00

Browse files
authored
Merge pull request #1 from peterkir/copilot/update-page-with-just-the-docs-template
Migrate peterkir.github.io to just-the-docs Jekyll theme with dark/light toggle, build footer, and archived PDFs
2 parents bf963cc + 4df21a8 commit 18dff00

15 files changed

Lines changed: 548 additions & 5 deletions

.github/workflows/deploy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy Jekyll site to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- copilot/update-page-with-just-the-docs-template
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Ruby
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: "3.2"
30+
bundler-cache: true
31+
32+
- name: Generate build info
33+
run: |
34+
mkdir -p _data
35+
SHORT_SHA="${GITHUB_SHA:0:7}"
36+
echo "sha: \"$GITHUB_SHA\"" > _data/build_info.yml
37+
echo "short_sha: \"$SHORT_SHA\"" >> _data/build_info.yml
38+
echo "datetime: \"$(date -u '+%Y-%m-%d %H:%M:%S UTC')\"" >> _data/build_info.yml
39+
40+
- name: Setup Pages
41+
id: pages
42+
uses: actions/configure-pages@v5
43+
44+
- name: Build with Jekyll
45+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
46+
env:
47+
JEKYLL_ENV: production
48+
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v3
51+
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source "https://rubygems.org"
2+
3+
gem "just-the-docs", "0.12.0"
4+
gem "webrick", "~> 1.8"

_config.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
title: Peter Kirschner
2+
description: >-
3+
Conference talks and OSGi/Eclipse development resources by Peter Kirschner.
4+
baseurl: ""
5+
url: "https://peterkir.github.io"
6+
7+
theme: just-the-docs
8+
9+
color_scheme: light
10+
11+
search_enabled: true
12+
search_tokenizer_separator: /[\s/]+/
13+
14+
nav_sort: order
15+
16+
back_to_top: true
17+
back_to_top_text: "Back to top"
18+
19+
heading_anchors: true
20+
21+
aux_links:
22+
"GitHub":
23+
- "https://github.com/peterkir"
24+
aux_links_new_tab: true
25+
26+
footer_content: ""
27+
28+
exclude:
29+
- Gemfile.lock
30+
- vendor/
31+
- node_modules/
32+
- "201410_EclipseCon_Europe/presentation/node_modules/"
33+
- "201410_EclipseCon_Europe/presentation/test/"
34+
- doc/

_data/build_info.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sha: "local"
2+
short_sha: "local"
3+
datetime: "local build"

_includes/footer_custom.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% if site.data.build_info %}
2+
<div class="build-info">
3+
Built: {{ site.data.build_info.datetime }}
4+
&bull;
5+
SHA: <a href="https://github.com/peterkir/peterkir.github.io/commit/{{ site.data.build_info.sha }}" target="_blank" rel="noopener">{{ site.data.build_info.short_sha }}</a>
6+
</div>
7+
{% endif %}

_includes/head_custom.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
// Apply theme before paint to prevent flash of unstyled content (FOUC)
3+
(function () {
4+
var saved = localStorage.getItem('theme');
5+
var preferred = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
6+
document.documentElement.setAttribute('data-theme', saved || preferred);
7+
})();
8+
</script>
9+
<link rel="stylesheet" href="{{ '/assets/css/dark-mode.css' | relative_url }}">

_includes/header_custom.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle dark mode" title="Toggle light/dark mode">
2+
<span class="moon-icon" aria-hidden="true">🌙</span>
3+
<span class="sun-icon" aria-hidden="true">☀️</span>
4+
</button>
5+
6+
<script>
7+
(function () {
8+
function applyTheme(theme) {
9+
document.documentElement.setAttribute('data-theme', theme);
10+
localStorage.setItem('theme', theme);
11+
}
12+
13+
function updateButton(theme) {
14+
var btn = document.getElementById('theme-toggle');
15+
if (!btn) return;
16+
btn.setAttribute('aria-pressed', theme === 'dark' ? 'true' : 'false');
17+
btn.title = theme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode';
18+
}
19+
20+
document.addEventListener('DOMContentLoaded', function () {
21+
var current = document.documentElement.getAttribute('data-theme') || 'light';
22+
updateButton(current);
23+
24+
document.getElementById('theme-toggle').addEventListener('click', function () {
25+
var next = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
26+
applyTheme(next);
27+
updateButton(next);
28+
});
29+
});
30+
})();
31+
</script>

0 commit comments

Comments
 (0)