Skip to content

Commit

Permalink
feat: Create blog
Browse files Browse the repository at this point in the history
TODO:
- Include page contexts when rendering descendant layouts; lowest layout should include chained parent contexts up to the first non-layout page (perhaps by making `page` a list of pages rather than just the immediate parent page?)
- Parallelise building
- `meta` context
- Write documentation on concepts (including usage)
- Document `main.rs`
- Create logo
  • Loading branch information
emmyoh committed May 30, 2024
1 parent 5e8c770 commit f89d320
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 56 deletions.
25 changes: 2 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,2 @@
# Vox
A performant static site generator built to scale.

## Features
* Fast build times.
* Intelligent rebuilding; only pages needing rebuilding are rebuilt.
* Flexible data model, perfect for any static site.

## Overview
Sites have the following structure:
- A `global.toml` file. Anything here defines the `{{ global }}` context.
- `.vox` files:
- Inside the `layouts` folder, defining pages which other pages can use as a template; layout pages provide the `{{ layout }}` context to their child pages.
- Inside the `snippets` folder, defining partial pages which can be embedded in other pages.
- Inside any other subdirectory, defining pages inside a collection; a collection provides its own context, referred to by the name of the subdirectory.
- Inside the root folder, defining pages not inside a collection.
All of the items above are optional; even the `global.toml` file is optional if no page requires it.

Building occurs in the following stages:
1. A directed acyclic graph (DAG) of pages (`.vox` files) is built.
2. Pages are built iteratively, descending the hierarchy of pages.
3. If serving, changed pages trigger rebuilds of themselves and their child pages.
- This avoids the need for a site-wide rebuild.
# [Vox](https://emmyoh.github.io/vox/)
A performant static site generator built to scale.
8 changes: 8 additions & 0 deletions site/blog/greetings.vox
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title = "Greetings from Vox"
date = 2024-05-30T00:00:00+00:00
layout = "post"
permalink = "date"
---

Welcome to the Vox blog! Here, you'll find posts regarding milestones and general discussion regarding static site generators.
4 changes: 2 additions & 2 deletions site/global.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ title = "Vox"
description = "A performant static site generator built to scale."
author = "Emil Sayahi"
locale = "en_US"
url = "https://emmyoh.github.io/vox"
# url = "http://localhost:80"
# url = "https://emmyoh.github.io/vox"
url = "http://localhost:80"
23 changes: 23 additions & 0 deletions site/guide/data_model.vox
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title = "Data Model"
layout = "page"
permalink = "none"
---

{% markdown %}

## Overview
{% raw %}
Sites have the following structure:
- A `global.toml` file. Anything here defines the `{{ global }}` context.
- `.vox` files:
- Inside the `layouts` folder, defining pages which other pages can use as a template; layout pages provide the `{{ layout }}` context to their child pages.
- Inside any other subdirectory, defining pages inside a collection; a collection provides its own context, referred to by the name of the subdirectory.
- Inside the root folder, defining pages not inside a collection.
- `.voxs` files:
- Inside the `snippets` folder, defining partial pages which can be embedded in other pages.
- Anything else is simply ignored.
All of the items above are optional; even the `global.toml` file is optional if no page requires it.
{% endraw %}

{% endmarkdown %}
25 changes: 7 additions & 18 deletions site/index.vox
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,17 @@ Vox is a static site generator that leverages technologies you know & love to bu

## Features
* Fast build times ({% math %}<0.5{% endmath %} seconds for a medium-sized site).
* Intelligent rebuilding.
* Flexible data model, perfect for any static site.
* Industry-standard languages (Liquid & TOML).
* Intelligent rendering pipeline.
* Intuitive, simplified data model that expands functionality effortlessly.
* General-purpose, perfect for any static site.
* Leverages industry-standard technologies (Liquid & TOML).
* Comes as a single binary, able to build or serve sites.
* Built site can be deployed anywhere.
* Built sites can be deployed anywhere.

## Resources
* <a href="{{ global.url | append: "/guide" }}">User Guide</a>
* <a href="{{ global.url | append: "/blog" }}">Development Blog</a>
* <a href="{{ global.url | append: "/diary" }}">Developer Diary</a>
* [Developer Documentation](https://emmyoh.github.io/vox/vox/)

## Overview
{% raw %}
Sites have the following structure:
- A `global.toml` file. Anything here defines the `{{ global }}` context.
- `.vox` files:
- Inside the `layouts` folder, defining pages which other pages can use as a template; layout pages provide the `{{ layout }}` context to their child pages.
- Inside any other subdirectory, defining pages inside a collection; a collection provides its own context, referred to by the name of the subdirectory.
- Inside the root folder, defining pages not inside a collection.
- `.voxs` files:
- Inside the `snippets` folder, defining partial pages which can be embedded in other pages.
- Anything else is simply ignored.
All of the items above are optional; even the `global.toml` file is optional if no page requires it.
{% endraw %}

{% endmarkdown %}
5 changes: 5 additions & 0 deletions site/pages/blog_atom.vox
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
collections = ["blog"]
permalink = "blog/atom.xml"
---
{% include atom.voxs posts = blog %}
7 changes: 7 additions & 0 deletions site/pages/blog_index.vox
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout = "default"
collections = ["blog"]
permalink = "blog/index.html"
---
{% assign posts = blog | sort: "blog.date" %}
{% include index.voxs posts = posts minimal = true %}
14 changes: 1 addition & 13 deletions site/pages/diary_index.vox
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,4 @@ collections = ["diary"]
permalink = "diary/index.html"
---
{% assign posts = diary | sort: "diary.date" %}
<div class="posts">
{% for post in posts %}
<article class="post">
<h1 class="post-title">
<a href="{{ post.url | prepend: global.url }}">
{{ post.data.title }}
</a>
</h1>
<time datetime="{{ post.date.rfc_2822 }}" class="post-date">{{ post.date.short_day }}, {{ post.date.day }} {{ post.date.short_month }} {{ post.date.year }}</time>
{{ post.rendered }}
</article>
{% endfor %}
</div>
{% include index.voxs posts = posts minimal = true %}
7 changes: 7 additions & 0 deletions site/pages/guide_index.vox
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout = "default"
collections = ["guide"]
permalink = "guide/index.html"
---
{% assign posts = guide | sort: "guide.date" %}
{% include index.voxs posts = posts minimal = true %}
2 changes: 2 additions & 0 deletions site/snippets/atom.voxs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<entry>
<title>{{ post.data.title | escape }}</title>
<link href="{{ post.url | escape | prepend: global.url }}"/>
{% if post.date %}
<updated>{{ post.date.rfc_2822 }}</updated>
{% endif %}
<id>{{ post.url | escape }}</id>
<content type="html">{{ post.rendered | escape }}</content>
</entry>
Expand Down
30 changes: 30 additions & 0 deletions site/snippets/index.voxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% if include.minimal %}
{% for post in include.posts %}
<article class="post">
<h1 class="post-title">
<a href="{{ post.url | prepend: global.url }}">
{{ post.data.title }}
</a>
</h1>
{% if post.date %}
<time datetime="{{ post.date.rfc_2822 }}" class="post-date">{{ post.date.short_day }}, {{ post.date.day }} {{ post.date.short_month }} {{ post.date.year }}</time>
{% endif %}
</article>
{% endfor %}
{% else %}
<div class="posts">
{% for post in include.posts %}
<article class="post">
<h1 class="post-title">
<a href="{{ post.url | prepend: global.url }}">
{{ post.data.title }}
</a>
</h1>
{% if post.date %}
<time datetime="{{ post.date.rfc_2822 }}" class="post-date">{{ post.date.short_day }}, {{ post.date.day }} {{ post.date.short_month }} {{ post.date.year }}</time>
{% endif %}
{{ post.rendered }}
</article>
{% endfor %}
</div>
{% endif %}

0 comments on commit f89d320

Please sign in to comment.