added quartz wiki
This commit is contained in:
145
quartz-setup/entrypoint.sh
Executable file
145
quartz-setup/entrypoint.sh
Executable file
@@ -0,0 +1,145 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Starting Quartz Wiki..."
|
||||
|
||||
# Check if content directory has files
|
||||
if [ -z "$(ls -A /app/content 2>/dev/null)" ]; then
|
||||
echo "Warning: Content directory is empty!"
|
||||
# Create a default index page
|
||||
mkdir -p /app/content
|
||||
echo "# Wiki Home
|
||||
|
||||
Willkommen im doing-it Wiki!
|
||||
|
||||
Dieses Wiki wird mit Obsidian Quartz betrieben.
|
||||
" > /app/content/index.md
|
||||
fi
|
||||
|
||||
# Copy content to Quartz content directory
|
||||
echo "Copying vault content to Quartz..."
|
||||
mkdir -p /app/quartz-repo/content
|
||||
cp -r /app/content/* /app/quartz-repo/content/ 2>/dev/null || true
|
||||
|
||||
# Build Quartz
|
||||
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'
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>doing-it Wiki</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
|
||||
background: #161618;
|
||||
color: #ebebec;
|
||||
line-height: 1.6;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 20px;
|
||||
color: #ebebec;
|
||||
}
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
margin: 40px 0 20px;
|
||||
color: #ebebec;
|
||||
}
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
margin: 15px 0;
|
||||
}
|
||||
a {
|
||||
color: #ff3b30;
|
||||
text-decoration: none;
|
||||
font-size: 18px;
|
||||
transition: color 0.3s;
|
||||
display: inline-block;
|
||||
}
|
||||
a:hover {
|
||||
color: #ff453a;
|
||||
}
|
||||
.intro {
|
||||
font-size: 20px;
|
||||
color: #d4d4d4;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.content-preview {
|
||||
background: #1c1c1e;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>doing-it Wiki</h1>
|
||||
<p class="intro">Willkommen im doing-it Wiki! Hier finden Sie nützliche Informationen rund um IT-Weiterbildung und Schulungen.</p>
|
||||
<h2>Inhalte</h2>
|
||||
<ul id="content-list">
|
||||
EOFHTML
|
||||
|
||||
# Find all markdown files and create links
|
||||
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
|
||||
fi
|
||||
|
||||
# Ensure public directory exists
|
||||
if [ ! -d "/app/public" ] || [ -z "$(ls -A /app/public 2>/dev/null)" ]; then
|
||||
echo "Error: Public directory is empty, creating minimal site..."
|
||||
mkdir -p /app/public
|
||||
echo "<!DOCTYPE html><html><head><meta charset='UTF-8'><title>doing-it Wiki</title></head><body><h1>doing-it Wiki</h1><p>Wiki wird geladen...</p></body></html>" > /app/public/index.html
|
||||
fi
|
||||
|
||||
echo "Build complete. Starting server on port 8080..."
|
||||
cd /app
|
||||
serve -s public -l 8080
|
||||
Reference in New Issue
Block a user