A modern, static site built entirely in Swift, featuring a beautiful design and powerful functionality.
- π¨ Beautiful Design: Modern, responsive design with Tailwind CSS
- π Markdown Support: Write posts in Markdown with YAML front matter
- π Search Integration: DocSearch integration for powerful site search
- π± Mobile Responsive: Optimized for all device sizes
- π― SEO Optimized: Automatic RSS feeds and sitemap generation
- β‘ Fast Generation: Lightning-fast static site generation
- π¨ Syntax Highlighting: Beautiful code blocks with custom syntax highlighting
- π Social Links: Linktree-style social media integration
- π Post Navigation: Previous/Next post navigation
- π Copy Code: One-click code copying functionality
- Language: Swift 6.0
- Web Framework: Custom Plot-inspired DSL
- Styling: Tailwind CSS v4
- Build Tool: Vite
- File System: swift-file
- Command Execution: swift-command
- Markdown: swift-markdown
- Logging: swift-log
- macOS 13.0+
- Swift 6.0+
- Node.js 18+ (for Tailwind CSS)
- npm or yarn
-
Clone the repository
git clone https://github.com/jihoonahn/website.git cd website -
Install dependencies
# Install Node.js dependencies npm install # Build the project swift build
-
Generate your blog
swift run Website
-
Preview locally (optional)
swift run Website preview
swift-blog-generator/
βββ Sources/
β βββ Website/ # Main website module
β β βββ Pages/ # Page components
β β βββ Components/ # Reusable components
β β βββ Layouts/ # Page layouts
β β βββ Styles/ # CSS styles
β β βββ Contents/ # Markdown content
β βββ Generator/ # Site generation logic
β βββ Web/ # Web framework (Plot-inspired)
βββ Public/ # Static assets
βββ dist/ # Generated website
βββ package.json # Node.js dependencies
Create Markdown files in Sources/Website/Contents/ with YAML front matter:
---
title: "Hello Swift 6.0!"
date: 2025-01-01
tags: ["swift", "programming"]
image: "/image/hello-swift.jpg"
description: "Exploring the new features in Swift 6.0"
---
# Hello Swift 6.2!
This is a sample blog post written in Markdown...
```swift
func hello() {
print("Hello, Swift 6.2!")
}
```
## π¨ Customization
### Styling
The blog uses Tailwind CSS v4 for styling. Customize the design by editing:
- `Sources/Website/Styles/global.css` - Global styles and theme
- `tailwind.config.js` - Tailwind configuration
### Components
Add new components in `Sources/Website/Components/`:
```swift
struct MyComponent: Component {
var body: Component {
Div {
Text("Hello, World!")
}
.class("my-custom-class")
}
}
Create new pages in Sources/Website/Pages/:
@HTMLBuilder
func myPage() -> HTML {
let metadata = SiteMetaData(title: "My Page")
Layout(metadata: metadata) {
Main {
H1("Welcome to My Page")
}
}
}-
Generate your site:
swift run Website
-
Push the
dist/folder to your GitHub Pages repository
- Connect your repository to Netlify
- Set build command:
swift run Website - Set publish directory:
dist
- Add
vercel.json:{ "buildCommand": "swift run Website", "outputDirectory": "dist" }
Edit Sources/Generator/Metadata/SiteMetadata.swift:
public struct SiteMetaData: Metadata {
public let title: String
public let description: String
public let url: String
public let favicon: Favicon?
}The RSS feed is automatically generated at /feed.rss with all your posts.
A sitemap is automatically generated at /sitemap.xml for SEO.
The blog includes DocSearch integration for powerful site search:
- Press
Ctrl+K(orCmd+Kon Mac) to open search - Search across all posts and pages
- Keyboard navigation support
Beautiful syntax highlighting for multiple languages:
- Swift
- JavaScript
- Python
- HTML/CSS
- And more!
Linktree-style social media integration on the About page:
- GitHub
- Custom links
Navigate between posts with Previous/Next buttons:
- Automatically sorted by date
- Responsive design
- Smooth transitions
This project is licensed under the MIT License - see the LICENSE file for details.