inclue all content for ease of editing

This commit is contained in:
Leonora Tindall 2022-09-21 14:00:19 -05:00
parent 3f008be16c
commit 0cafd7545d
5 changed files with 80 additions and 2 deletions

View File

@ -3,8 +3,15 @@
A Markdown renderer on the Compute@Edge platform from Fastly.
The main source file, `src/main.rs`, contains all the code for the renderer.
The header and footer files I use are included at `content/_header.md` and
`content/_footer.md` for easy inspection.
The content on the server is stored in `content/` for convenience.
## Deploying Content
Simply use `scp` to copy the files to the server:
```
scp -r ./content/* example.com:/var/www-html/edgeblog/
```
## Nginx Configuration

9
content/author.md Normal file
View File

@ -0,0 +1,9 @@
# About the Author
This very silly application was written by Leonora Tindall.
You can find her other work at [nora.codes](https://nora.codes),
or find her on [Twitter](https://twitter.com/NoraDotCodes)
and on the Fediverse at [Weirder Earth](https://weirder.earth/@noracodes).
Thanks for visiting!

View File

@ -0,0 +1,11 @@
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]-->
<!DOCTYPE html>
<html>
<head>
<title>with_cache</title>
<meta charset="utf-8"/>
</head>
<body><div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{&quot;highlight&quot;:&quot;#0000ff&quot;,&quot;nav&quot;:true,&quot;resize&quot;:true,&quot;toolbar&quot;:&quot;zoom layers tags lightbox&quot;,&quot;edit&quot;:&quot;_blank&quot;,&quot;xml&quot;:&quot;&lt;mxfile host=\&quot;app.diagrams.net\&quot; modified=\&quot;2022-09-20T15:36:42.143Z\&quot; agent=\&quot;5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36\&quot; etag=\&quot;m59Sz5y0B9XURcQJF8E1\&quot; version=\&quot;20.3.1\&quot; type=\&quot;device\&quot;&gt;&lt;diagram id=\&quot;Xpad1kBT1G1nm2uLucKE\&quot; name=\&quot;Page-1\&quot;&gt;7Vtdc5s4FP01zHQfkhGfxo+xk7Szm7SddXf6LIOwlQDygpzY++tXAgFGwnbSACZO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HufCSHL620llqyD7ltqe5a4AR1V1cnVD/RnFddlLAxdh61VgfaITo4x2Krq2J9wmiaEcZObJVSSzwPppjEMAy3p6+1pjW0YqurMnV6/ZUZspqbNiCKGALbLJH+XaOUnh5Ue3AKxlCL302Wpv+kDQRUlMF1FF55fDZQcU3GS99JiilLYXbInFBKogYyokTCleS6ZVp241uawY/kToyjgm02YN1dG1Kl+z6EhhB7x0TdcaFhgLzYHk2nUykSW508t6FIRq8TOi0pEmdPx6FTRVJkpMKx56dLjrDHOeoSQ+0FHyiJQ125k9sA5UreDslY/S6MGFbHwHa7cncAyJ5XmAxV4/1erXjBmJBWK+wGqdPvopMqdfZ1xqr4DiOQp+2OycuHp4+kqgj2Rup3d0zb16t2wPjScSrNaNT9/eoy1BG3HS1K5Vc9fKMSIzl6D+rVVPXN+enWfEB+KN1qqvLq3fXTZNHa8DRPv50fU21STkm0WlOkWeCG8+o7aKhZzuBgVVdaz7WhZjd0L3ttqJnq+msf2qS1htpQVu526vmbl+uafHW0RqfKkG5kRcEVTZPSgirPQlmMP5yysN55S34onfa3MIjcXu+QQeSeem8Mok6i87b6OU1MrI/XULdUDS2eiP+EY/Y7QhFJGiYfOzE9KveUoIf8yEnZ2GpqUTVLxJxuileSjGYCcsFt1ngp3jzi//gwXZZkVtBhtFnw17cuMUlHl5hlTXrpE28dZUnSxYNi9uhlrbBRV3LTUpvTX0kSQX6i/MDsM2a3aIBslO+dI71kIYDEVLzhZrQk4+UWo970Ysm4Tx1vua8WWKcHsU5lVtPaSUsgsn+rV/5y6qpenDRv/gc=&lt;/diagram&gt;&lt;/mxfile&gt;&quot;}"></div>
<script type="text/javascript" src="https://viewer.diagrams.net/js/viewer-static.min.js"></script>
</body>
</html>

BIN
content/images/diagram.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

51
content/index.md Normal file
View File

@ -0,0 +1,51 @@
### What?
This page is written in Markdown (actually in three Markdown files).
These Markdown files are requested by Fastly's Compute@Edge engine and rendered into
HTML at the edge, on every request.
You can check out the source code [here](https://git.nora.codes/nora/edgeblog).
The only dependency of the service, other than the Fastly SDK,
is Raph Levien's [`pulldown-cmark`][pulldown_cmark].
It's not an optimal choice, as it only supports one-shot rendering and requires buffering
the Markdown (though not the resulting HTML) in memory, but it's the best option available
at the moment.
[pulldown_cmark]: https://github.com/raphlinus/pulldown-cmark
[![A diagram showing the difference in pipeline between normal websites with a CDN and this monstrosity](images/diagram.jpg)](images/diagram.html)
The renderer takes advantage of the fact that Markdown allows embedding raw HTML by embedding
anything with a "text" MIME type in the Markdown source, while passing through anything
without a "text" MIME type - images, binary data, and so forth - unchanged.
That allows the above JPG image to embed properly, while also allowing the linked SVG image page
to be rendered as a component of a Markdown document.
### Why?
I work on the Compute@Edge platform and wanted to get some hands on experience with it.
This is not a good use of the platform for various reasons; among other things,
it buffers all page content in memory for every request, which is ridiculous.
A static site generator like [Hugo][hugo] or [Zola][zola] is an objectively better choice
for bulk rendering, while the C@E layer is better for filtering, editing, and dynamic content.
[hugo]: https://gohugo.io/
[zola]: https://www.getzola.org/
That said, this does demonstrate some interesting properties of the C@E platform.
For instance, the source files are hosted in [a subdirectory][source] of my webserver;
in theory, you could directory-traverse your way into my blog source, but in fact,
you can't.
[source]: https://nora.codes/edgeblog/
I also have a [Clacks Overhead][clacks] set for my webserver, and the C@E platform
is set up to make passing through existing headers trivial even with entirely
synthetic responses like these, so that header is preserved.
[clacks]: https://xclacksoverhead.org/home/about