From f89d320a4e48796ff62433a8469e29e2ac876103 Mon Sep 17 00:00:00 2001 From: Emil Sayahi <97276123+emmyoh@users.noreply.github.com> Date: Wed, 29 May 2024 22:04:12 -0400 Subject: [PATCH] feat: Create blog 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 --- README.md | 25 ++----------------------- site/blog/greetings.vox | 8 ++++++++ site/global.toml | 4 ++-- site/guide/data_model.vox | 23 +++++++++++++++++++++++ site/index.vox | 25 +++++++------------------ site/pages/blog_atom.vox | 5 +++++ site/pages/blog_index.vox | 7 +++++++ site/pages/diary_index.vox | 14 +------------- site/pages/guide_index.vox | 7 +++++++ site/snippets/atom.voxs | 2 ++ site/snippets/index.voxs | 30 ++++++++++++++++++++++++++++++ 11 files changed, 94 insertions(+), 56 deletions(-) create mode 100644 site/blog/greetings.vox create mode 100644 site/guide/data_model.vox create mode 100644 site/pages/blog_atom.vox create mode 100644 site/pages/blog_index.vox create mode 100644 site/pages/guide_index.vox create mode 100644 site/snippets/index.voxs diff --git a/README.md b/README.md index 3fcf854..3da9d6d 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +# [Vox](https://emmyoh.github.io/vox/) +A performant static site generator built to scale. \ No newline at end of file diff --git a/site/blog/greetings.vox b/site/blog/greetings.vox new file mode 100644 index 0000000..08e6324 --- /dev/null +++ b/site/blog/greetings.vox @@ -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. \ No newline at end of file diff --git a/site/global.toml b/site/global.toml index 29651ab..3c06162 100644 --- a/site/global.toml +++ b/site/global.toml @@ -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" \ No newline at end of file +# url = "https://emmyoh.github.io/vox" +url = "http://localhost:80" \ No newline at end of file diff --git a/site/guide/data_model.vox b/site/guide/data_model.vox new file mode 100644 index 0000000..46f98dc --- /dev/null +++ b/site/guide/data_model.vox @@ -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 %} \ No newline at end of file diff --git a/site/index.vox b/site/index.vox index d8a3e40..6e67ea7 100644 --- a/site/index.vox +++ b/site/index.vox @@ -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 +* User Guide +* Development Blog * Developer Diary * [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 %} \ No newline at end of file diff --git a/site/pages/blog_atom.vox b/site/pages/blog_atom.vox new file mode 100644 index 0000000..43ab6e7 --- /dev/null +++ b/site/pages/blog_atom.vox @@ -0,0 +1,5 @@ +--- +collections = ["blog"] +permalink = "blog/atom.xml" +--- +{% include atom.voxs posts = blog %} \ No newline at end of file diff --git a/site/pages/blog_index.vox b/site/pages/blog_index.vox new file mode 100644 index 0000000..caefe6d --- /dev/null +++ b/site/pages/blog_index.vox @@ -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 %} \ No newline at end of file diff --git a/site/pages/diary_index.vox b/site/pages/diary_index.vox index d515efd..32031fc 100644 --- a/site/pages/diary_index.vox +++ b/site/pages/diary_index.vox @@ -4,16 +4,4 @@ collections = ["diary"] permalink = "diary/index.html" --- {% assign posts = diary | sort: "diary.date" %} -
- {% for post in posts %} -
-

- - {{ post.data.title }} - -

- - {{ post.rendered }} -
- {% endfor %} -
\ No newline at end of file +{% include index.voxs posts = posts minimal = true %} \ No newline at end of file diff --git a/site/pages/guide_index.vox b/site/pages/guide_index.vox new file mode 100644 index 0000000..f91ece5 --- /dev/null +++ b/site/pages/guide_index.vox @@ -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 %} \ No newline at end of file diff --git a/site/snippets/atom.voxs b/site/snippets/atom.voxs index 8c2d614..70f0671 100644 --- a/site/snippets/atom.voxs +++ b/site/snippets/atom.voxs @@ -13,7 +13,9 @@ {{ post.data.title | escape }} + {% if post.date %} {{ post.date.rfc_2822 }} + {% endif %} {{ post.url | escape }} {{ post.rendered | escape }} diff --git a/site/snippets/index.voxs b/site/snippets/index.voxs new file mode 100644 index 0000000..6463f51 --- /dev/null +++ b/site/snippets/index.voxs @@ -0,0 +1,30 @@ +{% if include.minimal %} + {% for post in include.posts %} +
+

+ + {{ post.data.title }} + +

+ {% if post.date %} + + {% endif %} +
+ {% endfor %} +{% else %} +
+ {% for post in include.posts %} +
+

+ + {{ post.data.title }} + +

+ {% if post.date %} + + {% endif %} + {{ post.rendered }} +
+ {% endfor %} +
+{% endif %} \ No newline at end of file