Update documentation

This commit is contained in:
Nathan Upchurch 2024-07-09 11:36:16 -05:00
parent 0536a3aeb7
commit a7c7d31552

View File

@ -8,10 +8,62 @@ My blog, based on the very helpful eleventy-base-blog v8.
### Metadata
Site metadata such as author info, title, etc. lives in _data/metadata.js. Links on the /me page, and default post images are also configured here.
### How to add a cowsay to a post with the custom nunjucks filter
#### /me
Links at /me are configured in `metadata.js` like so:
``` javascript
socialLinks: [
{
title: "My Blog",
linkURL: "https://nathanupchurch.com",
linkDisplay: "My Blog",
iconURL: "/img/logo.svg"
}
]
```
Any links added here will render on the /me page.
#### Webrings
Webrings configured in `metadata.js` will display in the footer of most pages beneath the copyright notice:
``` javascript
webrings: [
{
name: "Fediring",
ringURL: "https://fediring.net/",
previousURL: "https://fediring.net/previous?host=nathanupchurch.com",
nextURL: "https://fediring.net/next?host=nathanupchurch.com"
}
]
```
Any links added here will render on the /me page.
### Add a cowsay to a post
You can use the `cowsay` filter to output a captioned `<figure>` containing a copy of an output from the cowsay program. Instead of using the usual three backticks, this method is accessible to visually impaired users thanks to the automatic captioning. Here's how to do it:
1. Add a copy of the cowsay output you'd like to display to _data/cowList.js. Be sure and escape any backslashes.
2. Use the filter like this: `{{ cowList.name | cowsay | safe }}`.
The `safe` filter is necessary so that Eleventy doesn't sanitize our HTML.
### Embed a toot in a post
Embed a toot from Mastodon using the `toot` shortcode:
```
{% toot "instance", "tootID" %}
```
For example:
```
{% toot "lounge.town", "112672230453089386" %}
```
Embedded toots are live, so if the toot or instance is not reachable, the toot will not be shown on the page. I haven't built any error handling for this yet.
### Adding comments via Mastodon
Simply add a toot ID to a post's frontmatter using the `mastodon_id` key in order to enable commenting via Mastodon:
```
mastodon_id: "111688829907363670"
```
The toot at the given ID will be embedded in a comment section at the bottom of the post; users can reply to the post on Mastodon and their replies will automatically be embedded on the post.
Like embedding a toot, comments are live and rely on the instance and toots / comments to be reachable on the remote server.
I also have not added any error handling for this, nor have I added any sort of moderation at this point.