Skip to content

Commit 0825c0a

Browse files
committed
more site fixes
1 parent 789ff69 commit 0825c0a

File tree

4 files changed

+426
-5
lines changed

4 files changed

+426
-5
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ jobs:
6969
7070
# Templates
7171
72-
Ready-to-use templates for adopting MCAF in your repository. These files define how AI agents work in your codebase, document architectural decisions, and describe features with clear test flows.
72+
Ready-to-use templates for adopting MCAF in your repository. <br/>
73+
These files define how AI agents work in your codebase, document architectural decisions, and describe features with clear test flows.
7374
7475
<div class="templates-list">
7576
HEADER
@@ -94,8 +95,12 @@ jobs:
9495
9596
- name: Copy README to github-pages with TOC
9697
run: |
98+
WORDS=$(wc -w < README.md)
99+
MINUTES=$(( (WORDS + 200) / 200 ))
97100
printf '%s\n' '---' 'layout: default' 'title: MCAF Guide' 'nav_order: 1' '---' '' > github-pages/index.md
98101
awk '/^---$/{exit} {print}' README.md >> github-pages/index.md
102+
echo "" >> github-pages/index.md
103+
echo "<p class=\"reading-time\">${MINUTES} min read</p>" >> github-pages/index.md
99104
echo '' >> github-pages/index.md
100105
echo '<nav class="toc">' >> github-pages/index.md
101106
echo '<div class="toc-title">Table of Contents</div>' >> github-pages/index.md

github-pages/404.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
layout: default
3+
title: "404"
4+
permalink: /404.html
5+
---
6+
7+
<div class="error-page">
8+
<h1>404</h1>
9+
<p class="error-subtitle">Page not found</p>
10+
<p class="error-joke">Looks like our AI agent couldn't find this page either.<br>Maybe it's still learning...</p>
11+
<div class="error-actions">
12+
<a href="{{ '/' | relative_url }}" class="btn btn-primary">Back to Guide</a>
13+
<a href="https://www.managed-code.com/" target="_blank" rel="noopener" class="btn">Visit Managed Code</a>
14+
</div>
15+
</div>

github-pages/_layouts/default.html

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
});
4646

4747
gtag('js', new Date());
48-
gtag('config', 'G-FMRJ311LEF', {
49-
anonymize_ip: true,
50-
send_page_view: true
51-
});
48+
gtag('config', 'G-FMRJ311LEF');
5249
</script>
5350

5451
<!-- Favicon -->
@@ -90,6 +87,11 @@
9087
<a href="{{ '/templates' | relative_url }}" {% if page.url == '/templates.html' %}class="active"{% endif %}>Templates</a>
9188
<a href="https://github.com/managedcode/MCAF" target="_blank" rel="noopener">GitHub</a>
9289
<a href="https://managed-code.com" target="_blank" rel="noopener" class="nav-brand">ManagedCode</a>
90+
<label class="dark-toggle-label" title="Toggle dark mode">
91+
<input type="checkbox" id="dark-toggle">
92+
<svg class="icon-sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
93+
<svg class="icon-moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
94+
</label>
9395
</div>
9496
</nav>
9597

@@ -141,6 +143,39 @@
141143
backToTop.addEventListener('click', () => {
142144
window.scrollTo({ top: 0, behavior: 'smooth' });
143145
});
146+
147+
// Copy code button
148+
document.querySelectorAll('pre').forEach(pre => {
149+
const btn = document.createElement('button');
150+
btn.className = 'copy-btn';
151+
btn.textContent = 'Copy';
152+
btn.addEventListener('click', () => {
153+
const code = pre.querySelector('code') || pre;
154+
navigator.clipboard.writeText(code.textContent).then(() => {
155+
btn.textContent = 'Copied!';
156+
setTimeout(() => btn.textContent = 'Copy', 2000);
157+
});
158+
});
159+
pre.style.position = 'relative';
160+
pre.appendChild(btn);
161+
});
162+
163+
// Dark mode
164+
const darkToggle = document.getElementById('dark-toggle');
165+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
166+
const stored = localStorage.getItem('darkMode');
167+
168+
if (stored === 'true' || (stored === null && prefersDark)) {
169+
document.body.classList.add('dark');
170+
if (darkToggle) darkToggle.checked = true;
171+
}
172+
173+
if (darkToggle) {
174+
darkToggle.addEventListener('change', () => {
175+
document.body.classList.toggle('dark');
176+
localStorage.setItem('darkMode', document.body.classList.contains('dark'));
177+
});
178+
}
144179
</script>
145180
</body>
146181
</html>

0 commit comments

Comments
 (0)