Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- dev

jobs:
deploy:
Expand Down
17 changes: 17 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -898,3 +898,20 @@ h1, h2, h3, h4, h5, h6 {
.doc-source-sep {
opacity: 0.3;
}

/* Dev site banner */
#dev-banner {
background: #92400e;
color: #fef3c7;
text-align: center;
padding: 8px 16px;
font-size: 0.85rem;
position: sticky;
top: 0;
z-index: 100;
}
#dev-banner a {
color: #fbbf24;
text-decoration: underline;
margin-left: 8px;
}
27 changes: 27 additions & 0 deletions js/docs-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
* Loads and renders markdown docs with marked.js + mermaid + highlight.js
*/

/* ============================================================
DEV SITE DETECTION
============================================================ */
function isDevSite() {
const host = window.location.hostname;
return host.includes('pages.dev') || host.startsWith('dev.');
}

/* ============================================================
I18N — UI string translations
============================================================ */
Expand Down Expand Up @@ -764,6 +772,25 @@ function migrateHashURL() {
INIT
============================================================ */
document.addEventListener('DOMContentLoaded', () => {
/* Dev site: show warning banner + noindex */
if (isDevSite()) {
const banner = document.createElement('div');
banner.id = 'dev-banner';
const lang = localStorage.getItem('goclaw-docs-lang') || 'en';
const msgs = {
en: '⚠️ Development docs — may differ from stable release.',
vi: '⚠️ Tài liệu phiên bản phát triển — có thể khác bản ổn định.',
zh: '⚠️ 开发版文档 — 可能与稳定版不同。',
};
banner.innerHTML = (msgs[lang] || msgs.en) + ' <a href="https://docs.goclaw.sh">Stable docs →</a>';
document.body.prepend(banner);

const noindex = document.createElement('meta');
noindex.name = 'robots';
noindex.content = 'noindex, nofollow';
document.head.appendChild(noindex);
}

initMarked();
initSidebar();
initMobileSidebar();
Expand Down
19 changes: 14 additions & 5 deletions scripts/audit-docs.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
#!/usr/bin/env bash
# audit-docs.sh — Find doc pages whose goclaw-source SHA is behind latest goclaw commit
# Usage: ./scripts/audit-docs.sh [--update]
# --update Update all outdated pages with current SHA and today's date
# Usage: ./scripts/audit-docs.sh [--update] [--source-branch=main|dev]
# --update Update all outdated pages with current SHA and today's date
# --source-branch=NAME GoClaw branch to audit against (default: main)

set -euo pipefail

GOCLAW_DIR="$(cd "$(dirname "$0")/../../goclaw" 2>/dev/null && pwd)" || {
echo "Error: ../goclaw directory not found"; exit 1
}
DOCS_DIR="$(cd "$(dirname "$0")/.." && pwd)"
LATEST_SHA=$(git -C "$GOCLAW_DIR" log -1 --format="%h")
TODAY=$(date +%Y-%m-%d)
UPDATE=false
[[ "${1:-}" == "--update" ]] && UPDATE=true
SOURCE_BRANCH="main"

echo "GoClaw latest: $LATEST_SHA"
for arg in "$@"; do
case "$arg" in
--update) UPDATE=true ;;
--source-branch=*) SOURCE_BRANCH="${arg#*=}" ;;
esac
done

LATEST_SHA=$(git -C "$GOCLAW_DIR" log -1 --format="%h" "$SOURCE_BRANCH")

echo "GoClaw branch: $SOURCE_BRANCH (latest: $LATEST_SHA)"
echo "Scanning docs in: $DOCS_DIR"
echo "---"

Expand Down