https://github.com/bloodyowl/rescript-pages
A static website generator
https://github.com/bloodyowl/rescript-pages
Last synced: 10 months ago
JSON representation
A static website generator
- Host: GitHub
- URL: https://github.com/bloodyowl/rescript-pages
- Owner: bloodyowl
- Created: 2020-11-11T17:09:56.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-21T10:40:09.000Z (over 1 year ago)
- Last Synced: 2025-01-25T13:45:08.443Z (12 months ago)
- Language: ReScript
- Homepage: https://bloodyowl.github.io/rescript-pages/
- Size: 2.13 MB
- Stars: 42
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-list - rescript-pages
README
# ReScript Pages

> Yet another static website generator
## Key features
- **Markdown collection based content**: Write markdown files in directories, the directories become _collections_, the files become _items_
- **Completely over-engineered**: generates a Single-Page-Application that kicks in after the initial load, loading the minimum delta to transition to the next page
- **Simple API**: you basically have two hooks to get data:
- `useItem(collection, ~id)`,
- `useCollection(collection, ~page=1, ~direction=#desc)`
- **Pagination**: You define the page size in your config, the generator creates the correct pagination
- **RSS & Sitemap** generation
- **i18n support**
## Installation
```console
$ yarn add rescript-pages
```
## Usage
Create an entry file with a `default` export with your configuration:
```js
let default = Pages.make(
App.make,
{
siteTitle: "Title",
siteDescription: "Description",
distDirectory: "dist",
baseUrl: "https://example.url",
staticsDirectory: Some("public"),
paginateBy: 20,
variants: [
{
subdirectory: None,
localeFile: None,
contentDirectory: "contents",
getUrlsToPrerender: ({getAll, getPages}) =>
Array.concatMany([
["/"],
getAll("pages")->Array.map(slug => `/${slug}`),
getAll("posts")->Array.map(slug => `/post/${slug}`),
["/posts"],
getPages("posts")->Array.map(page => `/posts/${page->Int.toString}`),
["404.html"],
]),
},
],
},
)
```
We provide two commands:
- **start**: starts a dev server
- **build**: builds the website
```console
$ pages start entry.bs.js
$ pages build entry.bs.js
```