added quartz external wiki

This commit is contained in:
2025-11-29 10:30:33 +01:00
parent b10f224a7b
commit 9be0af25f7
14 changed files with 824 additions and 62 deletions

View File

@@ -24,19 +24,48 @@ cp -r /app/content/* /app/quartz-repo/content/ 2>/dev/null || true
echo "Building Quartz site..."
cd /app/quartz-repo
# Build the site with default Quartz setup
npx quartz build 2>&1 || {
echo "Default Quartz build failed, trying alternative method..."
# Try building with explicit paths
npx quartz build --contentDir ./content --outputDir /app/public 2>&1 || {
echo "Default build also failed, creating fallback static site..."
# Create fallback static site
mkdir -p /app/public
cd /app/content
# Create index.html
cat > /app/public/index.html << 'EOFHTML'
# Check if Quartz CLI exists and try different methods
QUARTZ_CLI="/app/quartz-repo/node_modules/@jackyzha0/quartz/cli/index.js"
QUARTZ_BUILD_SUCCESS=false
# Method 1: Direct node call to Quartz CLI (avoids npx BusyBox issue)
if [ -f "$QUARTZ_CLI" ]; then
echo "Trying direct node call to Quartz CLI..."
if node "$QUARTZ_CLI" build --contentDir ./content --outputDir /app/public 2>&1; then
QUARTZ_BUILD_SUCCESS=true
echo "Quartz build successful!"
fi
fi
# Method 2: Try using npm run script
if [ "$QUARTZ_BUILD_SUCCESS" = false ] && [ -f "package.json" ]; then
echo "Trying npm run build..."
if npm run build 2>&1; then
QUARTZ_BUILD_SUCCESS=true
echo "Quartz build successful via npm!"
# Copy output if it went to default location
if [ -d "./public" ] && [ -n "$(ls -A ./public 2>/dev/null)" ]; then
cp -r ./public/* /app/public/ 2>/dev/null || true
fi
fi
fi
# If Quartz build succeeded, copy output
if [ "$QUARTZ_BUILD_SUCCESS" = true ]; then
if [ -d "/app/quartz-repo/public" ] && [ -n "$(ls -A /app/quartz-repo/public 2>/dev/null)" ]; then
echo "Copying Quartz output to public directory..."
cp -r /app/quartz-repo/public/* /app/public/ 2>/dev/null || true
fi
fi
# If build failed, create fallback static site
if [ "$QUARTZ_BUILD_SUCCESS" = false ]; then
echo "Quartz build failed, creating fallback static site..."
mkdir -p /app/public
cd /app/content
# Create index.html
cat > /app/public/index.html << 'EOFHTML'
<!DOCTYPE html>
<html lang="de">
<head>
@@ -94,12 +123,6 @@ npx quartz build 2>&1 || {
color: #d4d4d4;
margin-bottom: 40px;
}
.content-preview {
background: #1c1c1e;
border-radius: 8px;
padding: 20px;
margin: 20px 0;
}
</style>
</head>
<body>
@@ -110,27 +133,24 @@ npx quartz build 2>&1 || {
<ul id="content-list">
EOFHTML
# Find all markdown files and create links
# Find all markdown files and create links
if [ -n "$(find /app/content -name "*.md" -type f 2>/dev/null)" ]; then
find /app/content -name "*.md" -type f | while read file; do
title=$(basename "$file" .md)
relative_path=$(echo "$file" | sed "s|/app/content/||")
echo " <li><a href=\"/$relative_path\">$title</a></li>" >> /app/public/index.html
done
echo " </ul>" >> /app/public/index.html
echo " </div>" >> /app/public/index.html
echo "</body>" >> /app/public/index.html
echo "</html>" >> /app/public/index.html
# Copy markdown files to public
cp -r /app/content/* /app/public/ 2>/dev/null || true
}
}
# If Quartz build succeeded, check if public directory exists
if [ -d "/app/quartz-repo/public" ] && [ -n "$(ls -A /app/quartz-repo/public 2>/dev/null)" ]; then
echo "Copying Quartz output to public directory..."
cp -r /app/quartz-repo/public/* /app/public/ 2>/dev/null || true
else
echo " <li><em>Keine Inhalte gefunden</em></li>" >> /app/public/index.html
fi
echo " </ul>" >> /app/public/index.html
echo " </div>" >> /app/public/index.html
echo "</body>" >> /app/public/index.html
echo "</html>" >> /app/public/index.html
# Copy markdown files to public
cp -r /app/content/* /app/public/ 2>/dev/null || true
fi
# Ensure public directory exists