Files
boc/scripts/update-insights-index.sh
T
Bernt aee0f09db8 landvex: Fixar och tester klara för alla komponenter
- Datafabrik: Dockerfile fix, agentorkestrering fungerar
- Vision: Identify-modell, FAISS, OCR alla testade
- API: Alla 7 integrationstester passerade
- Upplösare: Entitetsupplösning verifierad
2026-07-05 06:41:32 +00:00

71 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Uppdatera /insights/index.html med alla publicerade artiklar
S3_BUCKET="s3://landvex-prod"
CF_DIST_ID="E2M3J95HLUR89H"
# Hämta lista över alla artiklar från S3
echo "Hämtar artiklar från S3..."
aws s3 ls $S3_BUCKET/insights/ | grep "PRE" | awk '{print $2}' | sed 's|/||' > /tmp/article-slugs.txt
# Generera HTML för varje artikel
echo "Genererar insights-index..."
ARTICLES_HTML=""
while read slug; do
if [ "$slug" != "" ] && [ "$slug" != "index.html" ]; then
# Hämta titel från artikeln
TITLE=$(curl -s "https://landvex.com/insights/$slug/" | grep -o '<title>.*</title>' | sed 's/<title>//;s/<\/title>//;s/ | Landvex//' | head -1)
if [ -z "$TITLE" ]; then
TITLE="$slug"
fi
ARTICLES_HTML="$ARTICLES_HTML
<div class=\"article-card\">
<h2><a href=\"/insights/$slug/\">$TITLE</a></h2>
</div>"
fi
done < /tmp/article-slugs.txt
# Skapa komplett HTML
cat > /tmp/insights-index.html << HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intelligence Insights | Landvex Blog</title>
<meta name="description" content="Research and analysis on decision intelligence, field data quality and the gap between official data and observed reality.">
<link rel="canonical" href="https://landvex.com/insights/">
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif; line-height: 1.6; max-width: 1200px; margin: 0 auto; padding: 40px 20px; color: #1a1a1a; }
h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 0.5em; }
.subtitle { color: #666; font-size: 1.2rem; margin-bottom: 3em; }
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 2em; }
.article-card { border: 1px solid #eee; border-radius: 8px; padding: 24px; transition: box-shadow 0.2s; }
.article-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.article-card h2 { font-size: 1.3rem; margin-top: 0; }
.article-card a { color: #1a1a1a; text-decoration: none; }
.article-card a:hover { color: #0066cc; }
</style>
</head>
<body>
<h1>Intelligence Insights</h1>
<p class="subtitle">Research and analysis on decision intelligence, field data quality and the gap between official data and observed reality.</p>
<div class="article-grid">
$ARTICLES_HTML
</div>
</body>
</html>
HTML
# Upload
aws s3 cp /tmp/insights-index.html $S3_BUCKET/insights/index.html --content-type "text/html" --cache-control "max-age=3600"
# Invalidate
aws cloudfront create-invalidation --distribution-id "$CF_DIST_ID" --paths "/insights/" --query 'Invalidation.Id' --output text
echo "✅ Insights index uppdaterad"