Skip to content

Commit c761ec8

Browse files
authored
Merge pull request #26 from SoundBlaster/claude/fix-docc-github-pages-urls-011CV2q14oULMheEHTbHVHsq
Claude/fix docc GitHub pages urls 011 cv2q14o ul mhe eh tb hv hsq
2 parents 9e99f45 + b3852d2 commit c761ec8

1 file changed

Lines changed: 56 additions & 58 deletions

File tree

.github/workflows/docc.yml

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -60,68 +60,66 @@ jobs:
6060
echo "=== Documentation processed for static hosting ==="
6161
echo "Hosting base path: $DOCC_HOSTING_BASE_PATH"
6262
63-
- name: Add .nojekyll and root redirect
63+
echo ""
64+
echo "=== Directory structure ==="
65+
find DocsBuild -type d | sort
66+
67+
echo ""
68+
echo "=== Files in documentation directory ==="
69+
find DocsBuild/documentation -type f 2>/dev/null | head -20 || echo "No documentation directory found"
70+
71+
echo ""
72+
echo "=== Files in tutorials directory ==="
73+
find DocsBuild/tutorials -type f 2>/dev/null | head -20 || echo "No tutorials directory found"
74+
75+
echo ""
76+
echo "=== Root level files ==="
77+
ls -la DocsBuild/
78+
79+
echo ""
80+
echo "=== Index directory contents ==="
81+
ls -la DocsBuild/index/ 2>/dev/null || echo "No index directory"
82+
83+
echo ""
84+
echo "=== Data directory structure ==="
85+
find DocsBuild/data -type f 2>/dev/null | head -10 || echo "No data directory"
86+
87+
echo ""
88+
echo "=== metadata.json content ==="
89+
cat DocsBuild/metadata.json 2>/dev/null || echo "No metadata.json"
90+
91+
echo ""
92+
echo "=== Original index.html content ==="
93+
cat DocsBuild/index.html
94+
95+
- name: Fix resource paths and add .nojekyll
6496
run: |
6597
# Add .nojekyll to prevent GitHub Pages from ignoring files starting with _
6698
touch DocsBuild/.nojekyll
6799
68-
# Create redirect from root to documentation page
69-
# The actual documentation lives at /documentation/<bundle-id>/
70-
cat > DocsBuild/index.html << 'EOF'
71-
<!DOCTYPE html>
72-
<html lang="en-US">
73-
<head>
74-
<meta charset="utf-8">
75-
<title>Redirecting to NavigationSplitView Documentation</title>
76-
<meta http-equiv="refresh" content="0; url=./documentation/navigationsplitview/">
77-
<link rel="canonical" href="./documentation/navigationsplitview/">
78-
<style>
79-
body {
80-
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
81-
display: flex;
82-
align-items: center;
83-
justify-content: center;
84-
height: 100vh;
85-
margin: 0;
86-
background: #f5f5f7;
87-
}
88-
.container {
89-
text-align: center;
90-
padding: 2rem;
91-
}
92-
h1 {
93-
font-size: 2rem;
94-
font-weight: 600;
95-
margin-bottom: 1rem;
96-
color: #1d1d1f;
97-
}
98-
p {
99-
font-size: 1.125rem;
100-
color: #86868b;
101-
}
102-
a {
103-
color: #0071e3;
104-
text-decoration: none;
105-
}
106-
a:hover {
107-
text-decoration: underline;
108-
}
109-
</style>
110-
</head>
111-
<body>
112-
<div class="container">
113-
<h1>NavigationSplitView Documentation</h1>
114-
<p>Redirecting to <a href="./documentation/navigationsplitview/">documentation</a>...</p>
115-
</div>
116-
<script>
117-
window.location.href = "./documentation/navigationsplitview/";
118-
</script>
119-
</body>
120-
</html>
121-
EOF
122-
123-
echo "=== Created root redirect ==="
124-
cat DocsBuild/index.html
100+
# Fix resource paths in HTML files
101+
# Even with DOCC_HOSTING_BASE_PATH in Xcode, DocC still generates absolute paths
102+
echo "=== Fixing resource paths in HTML files ==="
103+
find DocsBuild -type f -name "*.html" -exec sed -i '' \
104+
-e 's|var baseUrl = "/"|var baseUrl = "/'$DOCC_HOSTING_BASE_PATH'/"|g' \
105+
-e 's|src="/js/|src="/'$DOCC_HOSTING_BASE_PATH'/js/|g' \
106+
-e 's|src="/css/|src="/'$DOCC_HOSTING_BASE_PATH'/css/|g' \
107+
-e 's|href="/css/|href="/'$DOCC_HOSTING_BASE_PATH'/css/|g' \
108+
-e 's|href="/favicon.ico"|href="/'$DOCC_HOSTING_BASE_PATH'/favicon.ico"|g' \
109+
-e 's|href="/favicon.svg"|href="/'$DOCC_HOSTING_BASE_PATH'/favicon.svg"|g' \
110+
{} +
111+
112+
# Fix paths in JavaScript files
113+
echo "=== Fixing paths in JavaScript files ==="
114+
find DocsBuild -type f -name "*.js" -exec sed -i '' \
115+
-e 's|"/data/|"/'$DOCC_HOSTING_BASE_PATH'/data/|g' \
116+
-e 's|"/tutorials/|"/'$DOCC_HOSTING_BASE_PATH'/tutorials/|g' \
117+
-e 's|"/index/|"/'$DOCC_HOSTING_BASE_PATH'/index/|g' \
118+
{} +
119+
120+
echo "=== Fixed paths ==="
121+
echo "Fixed index.html:"
122+
head -5 DocsBuild/index.html
125123
126124
- name: Upload documentation artifact
127125
if: github.event_name == 'push'

0 commit comments

Comments
 (0)