Update landing page with EmDash CMS demo content

This commit is contained in:
Kunthawat Greethong
2026-04-29 07:34:57 +07:00
parent a6d4eebd71
commit 44809b1634
3 changed files with 550 additions and 992 deletions

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@ dist
.astro
uploads
data.db
data.db
*.db

View File

@@ -2,14 +2,14 @@
"$schema": "https://emdashcms.com/seed.schema.json",
"version": "1",
"meta": {
"name": "Blog Starter",
"description": "A blog with posts and pages",
"author": "EmDash"
"name": "EmDash CMS Demo",
"description": "A showcase of EmDash CMS - self-hosted, fully local, no cloud required",
"author": "EmDash Demo"
},
"settings": {
"title": "My Blog",
"tagline": "Thoughts on building for the web"
"title": "EmDash CMS Demo",
"tagline": "Self-hosted CMS for Astro - No cloud required, fully local"
},
"collections": [
@@ -18,7 +18,6 @@
"label": "Posts",
"labelSingular": "Post",
"supports": ["drafts", "revisions", "search", "seo"],
"commentsEnabled": true,
"fields": [
{
"slug": "title",
@@ -76,37 +75,10 @@
"hierarchical": true,
"collections": ["posts"],
"terms": [
{ "slug": "development", "label": "Development" },
{ "slug": "design", "label": "Design" },
{ "slug": "notes", "label": "Notes" }
{ "slug": "features", "label": "Features" },
{ "slug": "setup", "label": "Setup" },
{ "slug": "comparison", "label": "Comparison" }
]
},
{
"name": "tag",
"label": "Tags",
"labelSingular": "Tag",
"hierarchical": false,
"collections": ["posts"],
"terms": [
{ "slug": "webdev", "label": "Web Development" },
{ "slug": "opinion", "label": "Opinion" },
{ "slug": "tools", "label": "Tools" },
{ "slug": "creativity", "label": "Creativity" }
]
}
],
"bylines": [
{
"id": "byline-editorial",
"slug": "emdash-editorial",
"displayName": "EmDash Editorial"
},
{
"id": "byline-guest",
"slug": "guest-contributor",
"displayName": "Guest Contributor",
"isGuest": true
}
],
@@ -116,170 +88,40 @@
"label": "Primary Navigation",
"items": [
{ "type": "custom", "label": "Home", "url": "/" },
{ "type": "custom", "label": "About", "url": "/pages/about" },
{ "type": "custom", "label": "Posts", "url": "/posts" }
{ "type": "custom", "label": "Features", "url": "/#features" },
{ "type": "custom", "label": "Admin", "url": "/_emdash/admin" }
]
}
],
"widgetAreas": [
{
"name": "sidebar",
"label": "Sidebar",
"description": "Widget area displayed on single post pages",
"widgets": [
{
"type": "component",
"componentId": "core:search",
"title": "Search"
},
{
"type": "component",
"componentId": "core:categories",
"title": "Categories"
},
{
"type": "component",
"componentId": "core:tags",
"title": "Tags"
},
{
"type": "component",
"componentId": "core:recent-posts",
"title": "Recent Posts",
"settings": {
"count": 5,
"showDate": true
}
},
{
"type": "component",
"componentId": "core:archives",
"title": "Archives",
"settings": {
"type": "monthly",
"limit": 6
}
}
]
},
{
"name": "footer",
"label": "Footer",
"description": "Widget area displayed in the site footer",
"widgets": [
{
"type": "content",
"title": "About",
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "A blog about software, design, and the occasional stray thought."
}
]
}
]
}
]
}
],
"widgetAreas": [],
"sections": [
{
"slug": "newsletter-signup",
"title": "Newsletter Signup",
"description": "A call-to-action block for newsletter subscriptions",
"keywords": ["newsletter", "subscribe", "email", "cta"],
"source": "theme",
"content": [
{
"_type": "block",
"style": "h3",
"children": [{ "_type": "span", "text": "Stay in the loop" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Get notified when new posts are published. No spam, unsubscribe anytime."
}
]
}
]
},
{
"slug": "about-author",
"title": "About the Author",
"description": "Brief author bio for use in posts or pages",
"keywords": ["author", "bio", "about"],
"source": "theme",
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "A software developer who writes about building things on the web. Based somewhere with good coffee and reliable internet."
}
]
}
]
}
],
"sections": [],
"content": {
"pages": [
{
"id": "about",
"slug": "about",
"id": "home",
"slug": "home",
"status": "published",
"data": {
"title": "About",
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "A place for writing about software, design, and the occasional stray thought. No posting schedule, no newsletter funnel. Just things I wanted to write down."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Built with Astro and EmDash. The source is open if you want to see how it works."
}
]
}
]
"title": "EmDash CMS - Self-Hosted for Astro"
}
}
],
"posts": [
{
"id": "post-1",
"slug": "building-for-the-long-term",
"slug": "what-is-emdash",
"status": "published",
"data": {
"title": "Building for the Long Term",
"excerpt": "The frameworks will change. The databases will change. What survives is the clarity of your thinking.",
"title": "What is EmDash CMS?",
"excerpt": "A fully self-hosted CMS for Astro. No cloud account required, no external dependencies.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1461749280684-dccba630e2f6?w=1200&h=800&fit=crop",
"alt": "Code on a monitor in a dark room",
"filename": "building-long-term.jpg"
"url": "https://images.unsplash.com/photo-1555066931-4365d14bab8c?w=1200&h=800&fit=crop",
"alt": "Code on screen",
"filename": "what-is-emdash.jpg"
}
},
"content": [
@@ -289,24 +131,14 @@
"children": [
{
"_type": "span",
"text": "Every few years the industry collectively decides that everything we've been doing is wrong and there's a better way. New frameworks, new paradigms, new build tools. The churn is relentless, and if you're not careful, you spend more time migrating than building."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "I've been writing software long enough to have seen several of these cycles. jQuery to Backbone to Angular to React to whatever comes next. Each transition felt urgent at the time. Looking back, the things that actually mattered were rarely about the framework."
"text": "EmDash is a full-stack TypeScript CMS built on Astro. It gives you a complete admin panel, REST API, authentication, media library, and plugin system - all running on your own infrastructure."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "What survives" }]
"children": [{ "_type": "span", "text": "Key Features" }]
},
{
"_type": "block",
@@ -314,7 +146,7 @@
"children": [
{
"_type": "span",
"text": "Clean data models survive. Clear boundaries between systems survive. Good naming survives. The decision to keep things simple when you could have made them clever - that definitely survives."
"text": "- Fully self-hosted (SQLite, D1, Turso, PostgreSQL)"
}
]
},
@@ -324,7 +156,7 @@
"children": [
{
"_type": "span",
"text": "What doesn't survive is code that was written to impress, abstractions built for problems that never materialized, and architectures designed around a framework's opinions rather than the domain's reality."
"text": "- Admin panel at /_emdash/admin"
}
]
},
@@ -334,33 +166,38 @@
"children": [
{
"_type": "span",
"text": "The best code I've written is boring. It reads like prose, does one thing well, and doesn't require a PhD in category theory to understand. The worst code I've written was technically impressive at the time."
"text": "- Passkey-first auth with OAuth fallback"
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "- Built-in MCP server for AI integration"
}
]
}
]
},
"bylines": [
{ "byline": "byline-editorial" },
{ "byline": "byline-guest", "roleLabel": "Guest essay" }
],
"taxonomies": {
"category": ["development"],
"tag": ["opinion"]
"category": ["features"]
}
},
{
"id": "post-2",
"slug": "the-case-for-static",
"slug": "getting-started",
"status": "published",
"data": {
"title": "The Case for Static",
"excerpt": "Static sites aren't a step backwards. They're what you get when you take performance and simplicity seriously.",
"title": "Getting Started with EmDash",
"excerpt": "Set up your first EmDash project in under 5 minutes.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1499750310107-5fef28a66643?w=1200&h=800&fit=crop",
"alt": "Laptop and coffee on a wooden table",
"filename": "case-for-static.jpg"
"url": "https://images.unsplash.com/photo-1517180102446-f3ece451e9d8?w=1200&h=800&fit=crop",
"alt": "Developer workspace",
"filename": "getting-started.jpg"
}
},
"content": [
@@ -370,65 +207,28 @@
"children": [
{
"_type": "span",
"text": "There's a certain irony in the fact that the web started static, went dynamic, and is now swinging back toward static again. But the static sites of today aren't the hand-coded HTML pages of 1998. They're generated, optimized, and deployed to edge networks that serve them in milliseconds."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The pitch for server-rendered everything was compelling: dynamic content, personalization, real-time data. But most sites don't need most of that most of the time. A blog post doesn't need to be rendered on every request. A product page doesn't change every second."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "The performance argument" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "A static file served from a CDN is as fast as the web gets. No cold starts, no database queries, no server-side rendering overhead. The Time to First Byte is essentially the network latency to your nearest edge node. You can't beat physics."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "And when you do need dynamic behavior, you can add it surgically. An island of interactivity in a sea of static HTML. The best of both worlds, without paying the cost of either at all times."
"text": "Getting started is simple. Choose a template, run the bootstrap command, and you're ready to go."
}
]
}
]
},
"bylines": [{ "byline": "byline-editorial" }],
"taxonomies": {
"category": ["development"],
"tag": ["webdev", "opinion"]
"category": ["setup"]
}
},
{
"id": "post-3",
"slug": "learning-in-public",
"slug": "emdash-vs-tina",
"status": "published",
"data": {
"title": "Learning in Public",
"excerpt": "Writing about what you're learning is the fastest way to find out what you don't actually understand.",
"title": "EmDash vs Tina CMS",
"excerpt": "Comparing fully self-hosted options for Astro.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1432821596592-e2c18b78144f?w=1200&h=800&fit=crop",
"alt": "Notebook and pen on a desk",
"filename": "learning-in-public.jpg"
"url": "https://images.unsplash.com/photo-1558494949-ef010cbdcc31?w=1200&h=800&fit=crop",
"alt": "Two paths",
"filename": "comparison.jpg"
}
},
"content": [
@@ -438,339 +238,14 @@
"children": [
{
"_type": "span",
"text": "I started writing about things I was learning not because I had anything original to say, but because I kept forgetting what I'd figured out. The blog posts were notes to my future self, published publicly more out of laziness than courage."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "What I didn't expect was how much the writing itself would accelerate the learning. There's a particular kind of clarity that comes from trying to explain something to someone else. The gaps in your understanding, which you can happily ignore when the knowledge lives only in your head, become painfully obvious when you try to put it into sentences."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "The fear of being wrong" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The biggest barrier isn't time or writing skill. It's the fear of publishing something that turns out to be wrong. But here's the thing: being wrong publicly is one of the most efficient ways to learn. Someone will correct you, often kindly, and you'll remember that correction forever."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The posts that helped me most weren't written by experts. They were written by people one step ahead of me on the same path, in language that hadn't yet been polished into abstraction. There's a place for that kind of writing, and it's more valuable than most people realize."
"text": "EmDash and Tina both integrate with Astro, but differ significantly in their approach to CMS."
}
]
}
]
},
"taxonomies": {
"category": ["notes"],
"tag": ["opinion"]
}
},
{
"id": "post-4",
"slug": "small-tools-big-impact",
"status": "published",
"data": {
"title": "Small Tools, Big Impact",
"excerpt": "The best developer tools do one thing well and get out of your way. A love letter to focused software.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1575026615908-666710ae5e47?w=1200&h=800&fit=crop",
"alt": "Wrenches and hand tools hanging on a workshop wall",
"filename": "small-tools.jpg"
}
},
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "There's a class of software that doesn't get enough appreciation. Not the frameworks or the platforms or the IDEs, but the small, sharp tools that solve one problem so well you stop thinking about them. They become invisible, which is the highest compliment you can pay a tool."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "I'm talking about things like ripgrep, which searches code so fast it changed how I think about searching. Or jq, which makes JSON feel like a first-class data format in the terminal. Or curl, which has been quietly powering the internet's plumbing for decades."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "The Unix philosophy, revisited" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Do one thing well. The advice is old enough to be a cliche, but the best modern tools still follow it. They don't try to be platforms. They don't have plugin ecosystems or configuration languages or startup wizards. They do their job and they compose with other tools that do theirs."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The temptation is always to add more. One more feature, one more option, one more integration. But every addition is a decision someone has to make, a path through the code that has to be maintained, a thing that can break. The best tools resist this. They stay small, and in staying small, they stay reliable."
}
]
}
]
},
"taxonomies": {
"category": ["development"],
"tag": ["tools"]
}
},
{
"id": "post-5",
"slug": "designing-with-constraints",
"status": "published",
"data": {
"title": "Designing with Constraints",
"excerpt": "Limitations aren't obstacles to creativity. They're the structure that makes creativity possible.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1513542789411-b6a5d4f31634?w=1200&h=800&fit=crop",
"alt": "Pencils and design tools on a desk",
"filename": "designing-with-constraints.jpg"
}
},
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Give a designer a blank canvas and unlimited time, and they'll often produce something mediocre. Give them a tight brief, a small screen, and a deadline, and they'll surprise you. This isn't a paradox - it's how creativity actually works."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Constraints force decisions. When you can't use more than two typefaces, you have to choose carefully. When the page has to load in under a second, every element earns its place. When the interface has to work on a 320px screen, you discover what's truly essential."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "Embracing the box" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The web itself is a constraint. HTML flows in one direction. CSS has a box model. Browsers have viewport sizes and font rendering quirks. You can fight these constraints or you can work with them, and the results are dramatically different."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The designs I admire most don't look like they were forced through a framework. They look like they grew naturally from the medium, respecting its grain rather than working against it. That only happens when you treat constraints as creative partners rather than enemies."
}
]
}
]
},
"taxonomies": {
"category": ["design"],
"tag": ["creativity"]
}
},
{
"id": "post-6",
"slug": "a-weekend-with-a-side-project",
"status": "published",
"data": {
"title": "A Weekend with a Side Project",
"excerpt": "No stakeholders, no deadlines, no Jira tickets. Just you and a dumb idea that might turn into something.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1542831371-29b0f74f9713?w=1200&h=800&fit=crop",
"alt": "Code on a screen with a dark theme",
"filename": "weekend-side-project.jpg"
}
},
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Saturday morning. Coffee's made, the house is quiet, and I've got an idea that's been nagging at me all week. Not a good idea, necessarily - just a persistent one. A small tool that does a thing I keep doing manually. How hard could it be?"
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "This is the best kind of programming. No requirements document, no sprint planning, no pull request reviews. Just a text editor and a problem. The freedom to make terrible architectural decisions, rewrite everything twice, and follow tangents that turn out to be dead ends."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "Why side projects matter" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Side projects are where you learn things your day job would never teach you. Not because the problems are harder, but because you're free to take risks. Try a language you've never used. Build something without a framework. Deploy to a platform you've only read about. The stakes are zero, which makes the learning maximum."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "By Sunday evening, the thing sort of works. It's rough, the error handling is nonexistent, and the README is a single sentence. But it solves the problem I set out to solve, and I learned three things I didn't know on Friday. Not a bad weekend."
}
]
}
]
},
"taxonomies": {
"category": ["development"],
"tag": ["creativity"]
}
},
{
"id": "post-7",
"slug": "notes-on-simplicity",
"status": "published",
"data": {
"title": "Notes on Simplicity",
"excerpt": "Simplicity isn't the absence of complexity. It's the result of understanding a problem well enough to solve it cleanly.",
"featured_image": {
"$media": {
"url": "https://images.unsplash.com/photo-1559051668-e1fa58f25786?w=1200&h=800&fit=crop",
"alt": "Geometric pattern carved into white paper",
"filename": "notes-on-simplicity.jpg"
}
},
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Every piece of software starts simple. A few files, a clear purpose, a small surface area. Then features get added, edge cases get handled, and before long you're looking at something that requires a diagram to understand. This isn't inevitable, but it takes discipline to prevent."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The hard part of simplicity isn't the initial design. It's the ongoing resistance to complication. Every feature request, every bug fix, every refactor is an opportunity to add complexity. Saying no is the most important design skill, and the least celebrated."
}
]
},
{
"_type": "block",
"style": "h2",
"children": [{ "_type": "span", "text": "Removing as a feature" }]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "The best version of a product often has fewer features than the previous one. Not because features were missing, but because someone had the courage to remove things that weren't earning their keep. Every feature has a cost - in maintenance, in cognitive load, in the weight of the interface."
}
]
},
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "Simplicity is a practice, not a destination. You never arrive at simple. You just keep asking: is this necessary? Could this be clearer? Is there a way to solve this problem by removing something instead of adding something? The answer is yes more often than you'd expect."
}
]
}
]
},
"taxonomies": {
"category": ["notes"],
"tag": ["opinion"]
}
},
{
"id": "post-draft",
"slug": "work-in-progress",
"status": "draft",
"data": {
"title": "Work in Progress",
"excerpt": "This post is still being written.",
"content": [
{
"_type": "block",
"style": "normal",
"children": [
{
"_type": "span",
"text": "This is a draft post that won't appear in the public listing."
}
]
}
]
"category": ["comparison"]
}
}
]

View File

@@ -1,463 +1,544 @@
---
import {
getEmDashCollection,
getTermsForEntries,
getSiteSettings,
} from "emdash";
import { Image } from "emdash/ui";
import { getSiteSettings } from "emdash";
import Base from "../layouts/Base.astro";
import PostCard from "../components/PostCard.astro";
import { getReadingTime } from "../utils/reading-time";
import { resolveBlogSiteIdentity } from "../utils/site-identity";
// Limit to what we render (1 featured + 6 grid). The DB does the slicing
// instead of fetching every post and discarding the tail in JS.
const POSTS_PER_PAGE = 7;
const [{ entries: posts, cacheHint }, settings] = await Promise.all([
getEmDashCollection("posts", {
orderBy: { published_at: "desc" },
limit: POSTS_PER_PAGE + 1, // +1 to detect "view all" need
}),
getSiteSettings(),
]);
const { siteTitle, siteTagline } = resolveBlogSiteIdentity(settings);
Astro.cache.set(cacheHint);
// Trim the lookahead post used to detect overflow
const visiblePosts = posts.slice(0, POSTS_PER_PAGE);
const hasMorePosts = posts.length > POSTS_PER_PAGE;
// Find the first post with a featured image for the hero
const featuredPost = visiblePosts.find((p) => p.data.featured_image);
const featuredIndex = featuredPost ? visiblePosts.indexOf(featuredPost) : -1;
// Get remaining posts (exclude featured if found, limit to 6 for grid)
const gridPosts = visiblePosts.filter((_, i) => i !== featuredIndex).slice(0, 6);
// Single batched query for tags across the featured post + grid posts.
// Avoids the N+1 pattern of calling getEntryTerms() per entry.
// Bylines are already hydrated on entry.data.bylines by getEmDashCollection.
const tagEntryIds = [
...(featuredPost ? [featuredPost.data.id] : []),
...gridPosts.map((p) => p.data.id),
];
const tagsByEntry = await getTermsForEntries("posts", tagEntryIds, "tag");
const featuredTags = featuredPost
? (tagsByEntry.get(featuredPost.data.id) ?? []).map((t) => ({
slug: t.slug,
label: t.label,
}))
: [];
const featuredBylines = featuredPost?.data.bylines ?? [];
const gridPostsWithTags = gridPosts.map((post) => ({
post,
tags: (tagsByEntry.get(post.data.id) ?? []).map((t) => ({
slug: t.slug,
label: t.label,
})),
bylines: post.data.bylines ?? [],
}));
// Format date helper
function formatDate(date: Date | null | undefined) {
if (!date) return null;
return date.toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
});
}
const settings = await getSiteSettings();
---
<Base title="EmDash CMS - Self-Hosted for Astro" description="Fully self-hosted CMS for Astro. No cloud required, fully local, with admin panel, authentication, and plugin system.">
<main class="landing">
<!-- Hero Section -->
<section class="hero">
<div class="hero-content">
<div class="badge">Open Source • 10k+ Stars</div>
<h1 class="hero-title">
The CMS that<br />
<span class="accent">runs on your server</span>
</h1>
<p class="hero-subtitle">
EmDash is a full-stack TypeScript CMS built on Astro.
No cloud account required, no external dependencies.
Just a complete admin panel and your content.
</p>
<div class="hero-actions">
<a href="/_emdash/admin" class="btn btn-primary">
<span class="btn-icon">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<path d="M3 9h18M9 21V9"/>
</svg>
</span>
Open Admin Panel
</a>
<a href="https://github.com/emdash-cms/emdash" class="btn btn-secondary" target="_blank">
View on GitHub
</a>
</div>
</div>
<div class="hero-visual">
<div class="code-window">
<div class="code-header">
<span class="dot red"></span>
<span class="dot yellow"></span>
<span class="dot green"></span>
<span class="code-title">astro.config.mjs</span>
</div>
<pre class="code-content"><code><span class="keyword">import</span> emdash <span class="keyword">from</span> <span class="string">"emdash/astro"</span>;
<span class="keyword">import</span> { betterSqlite } <span class="keyword">from</span> <span class="string">"emdash/db"</span>;
<Base title={siteTitle} description={siteTagline}>
{
posts.length === 0 ? (
<section class="empty-state">
<h2>No posts yet</h2>
<p>Create your first post in the admin panel.</p>
<a href="/_emdash/admin/content/posts/new" class="btn">
Create a post
</a>
</section>
) : (
<div class="home-content">
{/* Featured Post - Side by side */}
{featuredPost && (
<section class="featured-section">
<div class="featured-grid">
<a href={`/posts/${featuredPost.id}`} class="featured-image-link">
<div class="featured-image">
<Image image={featuredPost.data.featured_image} />
</div>
</a>
<div class="featured-content">
<div class="featured-meta">
{featuredBylines.length > 0 && (
<>
<div class="featured-bylines">
{featuredBylines.slice(0, 2).map((credit, index) => (
<>
{index > 0 && <span class="byline-sep">,</span>}
<span class="featured-byline">
{credit.byline.avatarMediaId && (
<img
src={`/_emdash/api/media/file/${credit.byline.avatarMediaId}`}
alt={credit.byline.displayName}
class="featured-byline-avatar"
/>
)}
<span class="featured-byline-name">
{credit.byline.displayName}
</span>
</span>
</>
))}
{featuredBylines.length > 2 && (
<span class="byline-more">
+{featuredBylines.length - 2}
</span>
)}
</div>
<span class="meta-dot" />
</>
)}
{formatDate(featuredPost.data.publishedAt) && (
<time>{formatDate(featuredPost.data.publishedAt)}</time>
)}
<span class="meta-dot" />
<span>
{getReadingTime(featuredPost.data.content)} min read
</span>
</div>
<a
href={`/posts/${featuredPost.id}`}
class="featured-title-link"
>
<h1 class="featured-title">{featuredPost.data.title}</h1>
</a>
{featuredPost.data.excerpt && (
<p class="featured-excerpt">{featuredPost.data.excerpt}</p>
)}
{featuredTags.length > 0 && (
<div class="featured-tags">
{featuredTags.map((tag) => (
<a href={`/tag/${tag.slug}`} class="featured-tag">
{tag.label}
</a>
))}
</div>
)}
<span class="keyword">export default</span> defineConfig({
<span class="property">integrations</span>: [
emdash({
<span class="property">database</span>: betterSqlite({
<span class="property">databasePath</span>: <span class="string">"./data.db"</span>
}),
}),
],
});</code></pre>
</div>
</div>
</section>
)}
{/* Latest Posts */}
{gridPostsWithTags.length > 0 && (
<section class="posts-section">
<header class="section-header">
<h2 class="section-title">Latest</h2>
{hasMorePosts && (
<a href="/posts" class="section-link">
View all
</a>
)}
</header>
<div class="posts-grid">
{gridPostsWithTags.map(({ post, tags, bylines }) => (
<PostCard
title={post.data.title ?? "Untitled"}
excerpt={post.data.excerpt}
featuredImage={post.data.featured_image}
href={`/posts/${post.id}`}
date={post.data.publishedAt ?? undefined}
readingTime={getReadingTime(post.data.content)}
tags={tags}
bylines={bylines}
/>
))}
<!-- Features Section -->
<section class="features" id="features">
<div class="section-header">
<h2 class="section-title">Everything you need</h2>
<p class="section-subtitle">A complete CMS without the vendor lock-in</p>
</div>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
<path d="M2 17l10 5 10-5"/>
<path d="M2 12l10 5 10-5"/>
</svg>
</div>
<h3 class="feature-title">Fully Self-Hosted</h3>
<p class="feature-desc">
SQLite, D1, Turso, or PostgreSQL. Your data stays on your servers.
No cloud account required.
</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<path d="M3 9h18M9 21V9"/>
</svg>
</div>
<h3 class="feature-title">Admin Panel</h3>
<p class="feature-desc">
Visual schema builder, media library, navigation menus.
Full admin at /_emdash/admin
</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
</svg>
</div>
<h3 class="feature-title">Passkey Auth</h3>
<p class="feature-desc">
WebAuthn passkey-first authentication with OAuth and magic link fallbacks.
Role-based access control.
</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 6v6l4 2"/>
</svg>
</div>
<h3 class="feature-title">Built-in MCP</h3>
<p class="feature-desc">
Model Context Protocol server for AI tools.
Claude and ChatGPT can interact with your site directly.
</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="16 18 22 12 16 6"/>
<polyline points="8 6 2 12 8 18"/>
</svg>
</div>
<h3 class="feature-title">Plugin System</h3>
<p class="feature-desc">
Sandboxed plugins on Cloudflare Workers.
Define capabilities, run safely in isolation.
</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
</svg>
</div>
<h3 class="feature-title">WordPress Import</h3>
<p class="feature-desc">
Import posts, pages, media, and taxonomies from WXR exports,
REST API, or WordPress.com.
</p>
</div>
</div>
</section>
)}
<!-- Comparison Section -->
<section class="comparison">
<div class="section-header">
<h2 class="section-title">EmDash vs Tina CMS</h2>
<p class="section-subtitle">Both work with Astro, but differ in approach</p>
</div>
)
}
<div class="comparison-table">
<div class="comparison-header">
<div class="comparison-cell header">Feature</div>
<div class="comparison-cell header">EmDash</div>
<div class="comparison-cell header">Tina CMS</div>
</div>
<div class="comparison-row">
<div class="comparison-cell label">Self-hosted</div>
<div class="comparison-cell emdash">Fully local (SQLite)</div>
<div class="comparison-cell tina">Needs Tina Cloud</div>
</div>
<div class="comparison-row">
<div class="comparison-cell label">Admin URL</div>
<div class="comparison-cell emdash">/_emdash/admin</div>
<div class="comparison-cell tina">/admin</div>
</div>
<div class="comparison-row">
<div class="comparison-cell label">Database</div>
<div class="comparison-cell emdash">SQLite, D1, PostgreSQL</div>
<div class="comparison-cell tina">Git-based</div>
</div>
<div class="comparison-row">
<div class="comparison-cell label">Setup</div>
<div class="comparison-cell emdash">Template-based</div>
<div class="comparison-cell tina">Manual config</div>
</div>
<div class="comparison-row">
<div class="comparison-cell label">Auth</div>
<div class="comparison-cell emdash">Passkey + OAuth</div>
<div class="comparison-cell tina">Git-based</div>
</div>
<div class="comparison-row">
<div class="comparison-cell label">Price</div>
<div class="comparison-cell emdash">Free (open source)</div>
<div class="comparison-cell tina">Free tier + paid plans</div>
</div>
</div>
</section>
<!-- CTA Section -->
<section class="cta">
<div class="cta-content">
<h2 class="cta-title">Ready to get started?</h2>
<p class="cta-subtitle">
Clone the template, run bootstrap, and you're ready to build.
</p>
<div class="cta-actions">
<a href="/_emdash/admin" class="btn btn-primary btn-large">
Try Admin Panel
</a>
</div>
</div>
</section>
</main>
</Base>
<style>
.home-content {
max-width: var(--wide-width);
margin: 0 auto;
padding: var(--spacing-16) var(--spacing-6);
}
.landing {
--color-bg: #0a0a0f;
--color-surface: #14141f;
--color-surface-hover: #1a1a2e;
--color-border: #2a2a3e;
--color-text: #f0f0f5;
--color-text-secondary: #a0a0b0;
--color-muted: #6a6a80;
--color-accent: #6366f1;
--color-accent-hover: #818cf8;
--color-emdash: #10b981;
--color-tina: #f59e0b;
/* Featured Section - Side by side */
.featured-section {
margin-bottom: var(--spacing-16);
}
.featured-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--spacing-8);
align-items: center;
}
.featured-image-link {
grid-column: 1 / 3;
display: block;
/* Extend to viewport edge, but cap at -6rem minimum extension */
margin-left: min(
-6rem,
calc(-1 * (var(--spacing-6) + (100vw - var(--wide-width)) / 2))
);
}
.featured-image {
overflow: hidden;
border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
background: var(--color-surface);
}
.featured-image img {
width: 100%;
height: auto;
aspect-ratio: 4 / 3;
object-fit: cover;
transition: transform 0.4s ease;
}
.featured-image-link:hover .featured-image img,
.featured-grid:has(.featured-title-link:hover) .featured-image img {
transform: scale(1.02);
}
.featured-content {
display: flex;
flex-direction: column;
gap: var(--spacing-4);
}
.featured-meta {
display: flex;
align-items: center;
flex-wrap: wrap;
column-gap: var(--spacing-3);
row-gap: var(--spacing-1);
font-size: var(--font-size-sm);
color: var(--color-muted);
}
.meta-dot {
width: 3px;
height: 3px;
border-radius: 50%;
background: var(--color-muted);
}
/* Featured bylines */
.featured-bylines {
display: flex;
align-items: center;
gap: 2px;
}
.featured-byline {
display: inline-flex;
align-items: center;
gap: var(--spacing-2);
}
.featured-byline-avatar {
width: var(--avatar-size-md);
height: var(--avatar-size-md);
border-radius: 50%;
object-fit: cover;
}
.featured-byline-name {
font-weight: 500;
color: var(--color-text-secondary);
}
.byline-sep {
color: var(--color-muted);
margin-right: 2px;
}
.byline-more {
font-size: var(--font-size-xs);
color: var(--color-muted);
margin-left: 2px;
}
.featured-title-link {
text-decoration: none;
color: inherit;
}
.featured-title {
font-size: clamp(var(--font-size-2xl), 4vw, var(--font-size-4xl));
font-weight: 700;
line-height: var(--leading-tight);
letter-spacing: var(--tracking-tight);
transition: color var(--transition-fast);
}
.featured-title-link:hover .featured-title,
.featured-grid:has(.featured-image-link:hover) .featured-title {
color: var(--color-accent);
}
.featured-excerpt {
font-size: var(--font-size-lg);
line-height: var(--leading-relaxed);
color: var(--color-text-secondary);
}
.featured-tags {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-2);
margin-top: var(--spacing-2);
}
.featured-tag {
display: inline-block;
padding: var(--spacing-1) var(--spacing-3);
font-size: var(--font-size-sm);
color: var(--color-text-secondary);
background: var(--color-surface);
border-radius: var(--radius);
text-decoration: none;
transition:
color var(--transition-fast),
background var(--transition-fast);
}
.featured-tag:hover {
background: var(--color-bg);
color: var(--color-text);
background: var(--color-border);
min-height: 100vh;
}
/* Section header */
.section-header {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: var(--spacing-8);
padding-bottom: var(--spacing-4);
border-bottom: 1px solid var(--color-border-subtle);
}
.section-title {
font-size: var(--font-size-sm);
font-weight: 500;
text-transform: uppercase;
letter-spacing: var(--tracking-wider);
color: var(--color-muted);
}
.section-link {
font-size: var(--font-size-sm);
color: var(--color-accent);
text-decoration: none;
transition: color var(--transition-fast);
}
.section-link:hover {
color: var(--color-accent-hover);
}
/* Posts Grid */
.posts-section {
}
.posts-grid {
.hero {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--spacing-12) var(--spacing-8);
}
/* Empty State */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--spacing-3);
text-align: center;
padding: var(--spacing-20) var(--spacing-6);
max-width: 400px;
grid-template-columns: 1fr 1fr;
gap: 4rem;
max-width: 1200px;
margin: 0 auto;
padding: 6rem 2rem;
align-items: center;
}
.empty-state h2 {
font-size: var(--font-size-2xl);
font-weight: 600;
.badge {
display: inline-block;
padding: 0.5rem 1rem;
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 2rem;
font-size: 0.875rem;
color: var(--color-text-secondary);
margin-bottom: 1.5rem;
}
.empty-state p {
color: var(--color-muted);
.hero-title {
font-size: 3.5rem;
font-weight: 700;
line-height: 1.1;
margin-bottom: 1.5rem;
letter-spacing: -0.02em;
}
.accent {
color: var(--color-emdash);
}
.hero-subtitle {
font-size: 1.25rem;
line-height: 1.7;
color: var(--color-text-secondary);
margin-bottom: 2rem;
}
.hero-actions {
display: flex;
gap: 1rem;
}
.btn {
display: inline-block;
margin-top: var(--spacing-4);
padding: var(--spacing-3) var(--spacing-6);
background: var(--color-accent);
color: var(--color-on-accent);
text-decoration: none;
border-radius: var(--radius);
font-size: var(--font-size-sm);
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.875rem 1.5rem;
border-radius: 0.5rem;
font-weight: 500;
transition: background var(--transition-fast);
text-decoration: none;
transition: all 0.2s;
}
.btn:hover {
background: var(--color-accent-hover);
.btn-primary {
background: var(--color-emdash);
color: #0a0a0f;
}
.btn-primary:hover {
background: #059669;
}
.btn-secondary {
background: var(--color-surface);
color: var(--color-text);
border: 1px solid var(--color-border);
}
.btn-secondary:hover {
background: var(--color-surface-hover);
}
.btn-large {
padding: 1rem 2rem;
font-size: 1.125rem;
}
.code-window {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 0.75rem;
overflow: hidden;
}
.code-header {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1rem;
background: var(--color-surface-hover);
border-bottom: 1px solid var(--color-border);
}
.dot {
width: 12px;
height: 12px;
border-radius: 50%;
}
.dot.red { background: #ef4444; }
.dot.yellow { background: #eab308; }
.dot.green { background: #22c55e; }
.code-title {
margin-left: auto;
font-size: 0.75rem;
color: var(--color-muted);
}
.code-content {
padding: 1.5rem;
margin: 0;
font-family: 'JetBrains Mono', 'Fira Code', monospace;
font-size: 0.875rem;
line-height: 1.6;
overflow-x: auto;
}
.keyword { color: #c678dd; }
.string { color: #98c379; }
.property { color: #e5c07b; }
.features {
padding: 6rem 2rem;
max-width: 1200px;
margin: 0 auto;
}
.section-header {
text-align: center;
margin-bottom: 4rem;
}
.section-title {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
}
.section-subtitle {
font-size: 1.25rem;
color: var(--color-text-secondary);
}
.features-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
}
.feature-card {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 1rem;
padding: 2rem;
transition: all 0.2s;
}
.feature-card:hover {
border-color: var(--color-emdash);
transform: translateY(-4px);
}
.feature-icon {
width: 56px;
height: 56px;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--color-emdash), #059669);
border-radius: 0.75rem;
margin-bottom: 1.5rem;
color: white;
}
.feature-title {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
.feature-desc {
color: var(--color-text-secondary);
line-height: 1.6;
}
.comparison {
padding: 6rem 2rem;
max-width: 1000px;
margin: 0 auto;
}
.comparison-table {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 1rem;
overflow: hidden;
}
.comparison-header {
display: grid;
grid-template-columns: 1.5fr 1fr 1fr;
background: var(--color-surface-hover);
border-bottom: 1px solid var(--color-border);
}
.comparison-row {
display: grid;
grid-template-columns: 1.5fr 1fr 1fr;
border-bottom: 1px solid var(--color-border);
}
.comparison-row:last-child {
border-bottom: none;
}
.comparison-cell {
padding: 1rem 1.5rem;
font-size: 0.9375rem;
}
.comparison-cell.header {
font-weight: 600;
color: var(--color-muted);
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.05em;
}
.comparison-cell.label {
color: var(--color-text-secondary);
}
.comparison-cell.emdash {
color: var(--color-emdash);
font-weight: 500;
}
.comparison-cell.tina {
color: var(--color-tina);
font-weight: 500;
}
.cta {
padding: 8rem 2rem;
text-align: center;
background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-surface) 100%);
}
.cta-content {
max-width: 600px;
margin: 0 auto;
}
.cta-title {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
}
.cta-subtitle {
font-size: 1.25rem;
color: var(--color-text-secondary);
margin-bottom: 2rem;
}
/* Responsive */
@media (max-width: 900px) {
.home-content {
padding: var(--spacing-6) var(--spacing-4) var(--spacing-12);
}
.featured-image-link {
margin-left: 0;
}
.featured-grid {
.hero {
grid-template-columns: 1fr;
gap: var(--spacing-6);
padding: 4rem 2rem;
text-align: center;
}
.featured-image {
border-radius: var(--radius-lg);
.hero-actions {
justify-content: center;
}
.featured-image img {
aspect-ratio: 16 / 9;
.hero-title {
font-size: 2.5rem;
}
.posts-grid {
.features-grid {
grid-template-columns: repeat(2, 1fr);
gap: var(--spacing-8) var(--spacing-6);
}
.comparison-header,
.comparison-row {
grid-template-columns: 1fr 1fr;
}
.comparison-cell.header:last-child,
.comparison-cell:last-child {
display: none;
}
}
@media (max-width: 600px) {
.featured-title {
font-size: var(--font-size-2xl);
.hero-title {
font-size: 2rem;
}
.posts-grid {
.hero-actions {
flex-direction: column;
}
.features-grid {
grid-template-columns: 1fr;
gap: var(--spacing-8);
}
}
</style>