A static site generator for developers who donβt want opinions. Markdown, HTML, TS. No magic. Just output.
Bring your own templating engine or just render HTML. We don't care.
Need dynamic data? Write a
.controller.ts file and export params() and render().
Everything compiles to raw HTML. No client JS unless you say so.
Rift is built to be extended. Use plugins or write your own.
// src/rift.config.ts
import { defineConfig } from "@riftjs/rift";
import {
njkPlugin,
markdownPlugin,
staticAssets,
sitemapPlugin,
i18nPlugin,
minifyPlugin,
rssPlugin
} from "@riftjs/plugins";
// Configure your plugins to your needs
export default defineConfig({
baseUrl: "https://riftjs.dev",
plugins: [
njkPlugin(),
markdownPlugin(),
staticAssets([
{
src: "./assets/**/*",
dest: "./"
}
]),
sitemapPlugin({
exclude: ["/404", "/assets/*"],
}),
i18nPlugin({
locales: ["en", "es"],
defaultLocale: "en",
}),
minifyPlugin(),
rssPlugin({
collections: ["posts"],
permalink: ({ collection, locale, params }) => `/${locale}/post/${params.slug}`,
}),
]
});
Rift uses frontmatter to define metadata for your pages.
---
permalink: /post/my-first-post
date: 2023-10-01
tags: [rift, static site generator]
description: This is a description of my first post.
---
<h1>My First Post</h1>
<p>This is the content of my first post.</p>
Simple code. Full control over how your pages are created.
// src/controllers/blog.controller.ts
export function params() {
return await getContent("posts/**/*.md", item => ({
...item.metadata,
content: item.content,
}))
}
export async function permalink({ locale, params }) {
return `/${locale}/post/${params.slug}`;
}
Rift supports i18n out of the box.
// src/pages/page.rift
<span i18n="hello-world">Hello World</span>
// src/locales/en.json
{
"hello-world": "Hello World"
}
// src/locales/es.json
{
"hello-world": "Hola Mundo"
}
// src/pages/blog.controller.ts
export function params({ locale }) {
return await getContent(`posts/**/*.${locale}.md`, item => ({
...item.metadata,
content: item.content,
}))
}
Rift is designed to be simple and easy to understand.
π src βββ π assets β Static assets like images, icons β βββ πΌοΈ logo.png β Your site logo βββ π controllers β Controller files that export params/render β βββ βοΈ blog.controller.ts βββ π locales β Translation/localization JSON files β βββ π en.json β βββ π es.json βββ π pages β `.rift` files that define routes and layout β βββ π index.rift β βββ π post.rift βββ π content β Markdown content per locale β βββ π post1.en.md β βββ π post1.es.md β βββ π post2.en.md β βββ π post2.es.md βοΈ rift.config.ts β Project config file
Join our Discord community and follow us on Twitter for updates.
Check out some amazing sites built with Rift.
Ready to build your next static site? Start your journey with Rift today.
Explore the DocsNo venture funding. No corporate backing. Just code that works. Help keep it that way.
Sponsor Rift