This repository contains a single-file blog website powered by SleekCMS.
It loads content using the official @sleekcms/client, renders a home page and blog posts, and navigates using SPA routing (hash-based or history state) — all without a build step.
The entire site lives in one HTML file.
Features
- ✅ Single HTML file (no build, no bundler)
- ✅ Uses
@sleekcms/clientfrom unpkg - ✅ Configurable routing: hash-based (
#/) or history state (/) - ✅ Home page with list of blog posts
- ✅ Blog post page with title, image, and HTML content
- ✅ Works on any static host (Netlify, Vercel, GitHub Pages, S3, etc.)
- ✅ “View source” link for easy inspection
How It Works
Content Source
Content is fetched directly from SleekCMS public delivery API using:
SleekCMS.createSyncClient({ siteToken: 'your-site-token', env: 'latest' })
The client provides:
getPage('/')→ home page metadatagetPages('/blog')→ all blog posts
No REST calls, no manual JSON parsing.
Content Structure in SleekCMS
Home Page
| Field | Type |
|---|---|
| title | Text |
Path:
Blog Posts
| Field | Type |
|---|---|
| title | Text |
| image | Image |
| content | HTML / Rich Text |
Path pattern:
Setup
1. Create a SleekCMS Site
- Sign up at https://sleekcms.com
- Create a site
- Add page models for Home and Blog
2. Get Your Site Token
From the SleekCMS dashboard, copy the Public Site Token.
3. Update the HTML File
Edit the configuration at the top of index.html:
const SITE_TOKEN = "your-site-token"; const ENV = "latest"; const SPA = true; // Set to true for history state routing, false for hash routing
Routing Options:
SPA = true: Uses clean URLs withhistory.pushState(/,/blog/post-slug)- Requires server rewrites or
_redirectsfile for production deployment - Best for modern hosting platforms (Netlify, Vercel)
- Requires server rewrites or
SPA = false: Uses hash-based routing (#/,#/blog/post-slug)- Works without server configuration
- Ideal for simple hosting (GitHub Pages, S3)
4. Open or Deploy
Open locally or deploy to any static host.
Routing
This site supports two routing modes controlled by the SPA flag:
History State Routing (SPA = true)
- Uses
history.pushStatefor clean URLs without hash symbols - URLs look like:
/,/blog/my-post - Requires server-side configuration to redirect all requests to
index.html - Deployment requirements:
- Netlify/Vercel: Include
_redirectsfile (already provided) - Apache: Use
.htaccesswithRewriteRule - Nginx: Configure
try_files $uri /index.html
- Netlify/Vercel: Include
Hash-Based Routing (SPA = false)
- Uses URL hash for navigation
- URLs look like:
#/,#/blog/my-post - No server configuration needed — works anywhere
- Best for: GitHub Pages, S3 static hosting, or simple CDN deployments
The included _redirects file enables history state routing on Netlify:
License
MIT