Just write markdown files in directories! The directories become collections, the markdown files items.
---
title: My post
date: 2020-11-20
---
Hello!
When the client boots, there's no subsequent page reload, it only fetches the missing data to navigate to the next page (but it works without JS!).
@react.component
let make = (~url, ~config) => {
/* your app */
}
You only need two hooks to access the data from your markdown files. At build time, the system knows what you read from your components.
/* items */
Pages.useItem(collection, ~id)
/* collections */
Pages.useCollection(collection)
You define the page size in your config, the generator creates the correct paginated pages & API endpoints.
Pages.useCollection(
collection,
~page=1,
~direction=#asc
)
ReScript Pages automatically generates a sitemap, and RSS feeds are created for each collection.
<Pages.Head>
<title>
{post.title->React.string}
</title>
</Pages.Head>
A ReScript Pages config contains variants
. Each variant can specify its content source, destination path and locales. You simply provide the dictionnary.
Pages.t("Hello")
/* "Hello" in english */
/* "Bonjour" in french */