add example site config and content

This commit is contained in:
Gered 2023-06-27 17:18:52 -04:00
parent 4c3fc25e50
commit 3f18b2a58a
19 changed files with 433 additions and 0 deletions

9
example-site/pages.json Normal file
View file

@ -0,0 +1,9 @@
{
"pages": [
{
"file_path": "about.md",
"title": "About This Site",
"url": "/about/"
}
]
}

View file

@ -0,0 +1,3 @@
This is the so-called "about" page. Probably you'd write something to describe what this site is. I guess?
However, here you will only find a bunch of words to fill up space.

44
example-site/posts.json Normal file
View file

@ -0,0 +1,44 @@
{
"posts": [
{
"file_path": "2023-01-01-hello-world.md",
"title": "Hello, world!",
"date": "2023-01-01",
"slug": "hello-world",
"tags": ["aaa", "hello", "testing"]
},
{
"file_path": "2023-02-01-commonmark-testing.md",
"title": "CommonMark Testing",
"date": "2023-02-01",
"slug": "commonmark-testing",
"tags": ["testing"]
},
{
"file_path": "2023-03-20-lorem-ipsum.md",
"title": "Lorem Ipsum",
"date": "2023-03-20",
"slug": "lorem-ipsum"
},
{
"file_path": "2023-04-15-static-site-generators-are-boring.md",
"title": "Static Site Generators Are Boring",
"date": "2023-04-15",
"slug": "static-site-generators-are-boring",
"tags": ["aaa", "rant"]
},
{
"file_path": "2023-06-27-donuts-are-pretty-great.md",
"title": "Donuts Are Pretty Great",
"date": "2023-06-27",
"slug": "donuts-are-pretty-great",
"tags": ["aaa", "donuts", "coffee"]
}
],
"rss": {
"title": "My Site",
"description": "This is my site. There are others like it, but this one is mine.",
"url": "http://localhost:8080/",
"count": 10
}
}

View file

@ -0,0 +1,10 @@
Hello, world!
```c
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello, world!\n");
return 0;
}
```

View file

@ -0,0 +1,158 @@
Here we test some [CommonMark](https://commonmark.org/) things, gloriously rendered via the
[pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) crate!
---
This is a sentence rendered as a paragraph.
This is a sentence that is also rendered as a paragraph,
but it has a forced line-break in the middle of it!
This is normal text.
_This is italicized text._
*This is also italicized text.*
**This is bolded text.**
__This is also bolded text.__
~~This is strikethrough text.~~
We can also **escape** characters to skip applying formatting like \_so_!
# Heading Level 1
## Heading Level 2
### Heading Level 3
#### Heading Level 4
##### Heading Level 5
###### Heading Level 6
Heading Level 1 Alternate
=========================
Heading Level 2 Alternate
-------------------------
> This is rendered as a block quote.
Also ...
> This is rendered as a multi-line block quote.
> This is in the same block quote.
>
> And finally, this is also in the same block quote!
But wait, there's more!
> Block quote again.
> > Nested block quote action! Wow!
1. Number one
2. Number two
3. Number three
- First
- Second
- And finally, third!
1. One item which is multi-line.
This is the second line of the first item.
2. Here is item number two.
3. And item number three.
* First item
* First item, first sub-item
* First item, second sub-item
* Second item
* Third item
1. First item
1. First item, first sub-item
2. First item, second sub-item
2. Second item
3. Third item
* More lists
* Because why not?
* It's getting a little tiresome ...
* So this will be the last one!
Escaping to prevent accidental un-ordered list rendering ...
\* Like so
Task lists!
- [ ] Task 1
- [x] Task 2 (completed!)
Here's some tables. To be honest, this syntax really sucks for anything but the very simplest of tables ...
| foo | bar | longer column heading |
|-----|-----|-----------------------|
| yes | no | hi |
| 1 | 2 | 3 |
| left | right |
|:-----|------:|
| a | b |
| one | two |
| lazy | cell | formatting |
|------|------|------------|
| a | b | c |
| one | two | three |
Here's a code block.
```
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello, world!\n");
return 0;
}
```
Here's a code block with a language specified (which could be syntax highlighted if the right server-side parsing
was happening ...).
```c
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello, world!\n");
return 0;
}
```
Code blocks can also be indented like so:
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello, world!\n");
return 0;
}
Here's some inline `code` bits that will appear `inline` within this paragraph.
<div class="foobar">
We can also render <strong>html</strong> inline.
</div>
And we can place horizontal rules:
---
And we can have images!
![An image](/images/coffee_and_donuts.jpg)
Images can also be links:
[![An image](/images/coffee_and_donuts.jpg)](/images/coffee_and_donuts.jpg)

View file

@ -0,0 +1,33 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Vitae suscipit tellus mauris a. Ac turpis egestas maecenas pharetra convallis. Tincidunt dui ut ornare lectus
sit amet est placerat. Nibh ipsum consequat nisl vel pretium lectus quam id leo. Sit amet consectetur adipiscing elit.
Pretium viverra suspendisse potenti nullam ac tortor. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl
rhoncus. Etiam sit amet nisl purus in mollis nunc sed id. Mollis nunc sed id semper risus in. In hendrerit gravida
rutrum quisque non tellus orci. Justo laoreet sit amet cursus sit amet dictum. Egestas erat imperdiet sed euismod nisi
porta.
Risus commodo viverra maecenas accumsan lacus. Gravida arcu ac tortor dignissim convallis aenean et. Ornare lectus sit
amet est placerat in egestas erat. Imperdiet nulla malesuada pellentesque elit eget. Porta lorem mollis aliquam ut.
Ornare arcu dui vivamus arcu felis. Urna id volutpat lacus laoreet non curabitur. Donec adipiscing tristique risus nec
feugiat in fermentum. Netus et malesuada fames ac turpis egestas. Enim nulla aliquet porttitor lacus luctus accumsan
tortor.
Nulla pellentesque dignissim enim sit amet venenatis urna cursus. Nisi est sit amet facilisis magna etiam. Egestas dui
id ornare arcu odio ut. Fusce ut placerat orci nulla pellentesque dignissim enim sit. Nec feugiat in fermentum posuere
urna nec tincidunt praesent. Malesuada pellentesque elit eget gravida cum sociis natoque penatibus et. Duis at tellus
at urna condimentum. Enim ut tellus elementum sagittis vitae et. Semper eget duis at tellus at urna condimentum mattis.
Et molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit. Vulputate eu scelerisque felis imperdiet proin
fermentum leo. Dolor sed viverra ipsum nunc.
Vitae congue eu consequat ac felis. Fermentum dui faucibus in ornare quam viverra orci sagittis eu. Lobortis elementum
nibh tellus molestie nunc non. Libero justo laoreet sit amet cursus sit amet dictum. Aliquam id diam maecenas ultricies
mi. Dictum at tempor commodo ullamcorper a lacus. Sagittis purus sit amet volutpat consequat. Posuere morbi leo urna
molestie at elementum eu facilisis. Nibh praesent tristique magna sit amet purus gravida. Porta non pulvinar neque
laoreet. Vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Tempor orci eu
lobortis elementum nibh tellus molestie. Nulla facilisi nullam vehicula ipsum.
Tristique et egestas quis ipsum suspendisse. Sit amet massa vitae tortor condimentum lacinia quis vel. Eget nullam non
nisi est sit amet facilisis magna etiam. Donec pretium vulputate sapien nec sagittis aliquam. Scelerisque viverra
mauris in aliquam sem fringilla ut morbi tincidunt. Id aliquet lectus proin nibh nisl condimentum. Nulla facilisi
nullam vehicula ipsum a arcu cursus vitae congue. Convallis tellus id interdum velit laoreet id donec. Porttitor
rhoncus dolor purus non enim praesent elementum facilisis. Gravida neque convallis a cras semper auctor neque.

View file

@ -0,0 +1,11 @@
It's true.
Static site generators are boring. Sure, they can be used to generate all the files necessary for many types of
websites and then be uploaded somewhere and served up in an incredible efficient fashion.
But they're boring.
And there's so many of them out there. And I really can't be arsed to futz about with their endless configuration
options and templating and so forth.
Bleh!

View file

@ -0,0 +1,8 @@
Donuts are pretty great. Even better when you have more than one. Especially so when you have sprinkles on some or all
of them. And this all becomes _significantly better_ when paired up with coffee. Which should always be just black,
because why would anyone want to do something gross like dunk extra sugar, milk or cream into your coffee? What a
horrible thing to do ...
![](/images/coffee_and_donuts.jpg)
Have a coffee and donut today! 🍩 ☕

8
example-site/server.json Normal file
View file

@ -0,0 +1,8 @@
{
"bind_addr": "127.0.0.1",
"bind_port": 8080,
"static_files_path": "static",
"templates_path": "templates",
"pages_path": "pages",
"posts_path": "posts"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View file

@ -0,0 +1,45 @@
body {
font-family: sans-serif;
}
main {
padding-bottom: 1em;
}
footer {
color: #777777;
font-style: italic;
}
.meta {
font-style: italic;
}
.tags > span {
margin: auto 2px;
padding: 1px;
background-color: #eeeeee;
}
.tags > span > a {
color: #555555;
}
.tags > span > a:visited {
color: #888888;
}
blockquote {
padding: 3px;
background-color: #dddddd;
border-left: 5px solid #888888;
}
table {
border-collapse: collapse;
margin-bottom: 1em;
}
table td, table th {
border: 1px solid #dddddd;
}

View file

@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block title %}Posts Archive{% endblock title %}
{% block content %}
<header>
<h1>Posts Archive</h1>
</header>
<table>
{% for post in posts %}
<tr>
<td><time>{{ post.date }}</time></td>
<td>
<a href="{{ post.url }}">{{ post.title }}</a>
<span class="tags">
{%- for tag in post.tags -%}
<span><a href="/tag/{{ tag }}/">{{ tag }}</a></span>
{%- endfor -%}
</span>
</td>
</tr>
{% endfor %}
</table>
{% endblock content %}

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Site :: {% block title %}{% endblock title %}</title>
<link rel="stylesheet" type="text/css" href="/site.css">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="alternate" type="application/rss+xml" title="My Site" href="/rss/">
</head>
<body>
<div id="wrapper">
<header>
<h2>My Site</h2>
<nav>
<a href="/">Home</a> |
<a href="/archive/">Archive</a> |
<a href="/about/">About</a>
</nav>
</header>
<main>
{% block content %}{% endblock content %}
</main>
<footer>
&copy; {{ now() | date(format="%Y") }} - My Site, by Me
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block title %}{{ page.title }}{% endblock title %}
{% block content %}
{% include "partials/page.html" %}
{% endblock content %}

View file

@ -0,0 +1,6 @@
<article class="page">
<header><h1>{{ page.title }}</h1></header>
<section>
{{ page.content_html | safe }}
</section>
</article>

View file

@ -0,0 +1,16 @@
<article class="post">
<header>
<h1>{{ post.title }}</h1>
<div class="meta">
{{ post.date }} &mdash;
<span class="tags">
{%- for tag in post.tags -%}
<span><a href="/tag/{{ tag }}/">{{ tag }}</a></span>
{%- endfor -%}
</span>
</div>
</header>
<section>
{{ post.content_html | safe }}
</section>
</article>

View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block title %}{{ post.title }}{% endblock title %}
{% block content %}
{% include "partials/post.html" %}
{% endblock content %}

View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}Posts With Tag {{ tag }}{% endblock title %}
{% block content %}
<header>
<h1>Posts With Tag "{{ tag }}"</h1>
</header>
<table>
{% for post in posts %}
<tr>
<td><time>{{ post.date }}</time></td>
<td><a href="{{ post.url }}">{{ post.title }}</a></td>
</tr>
{% endfor %}
</table>
{% endblock content %}