Add documentation about image_url and custom favicon v1 APPLIED

Alexey Shpakovsky: 1
 Add documentation about image_url and custom favicon

 1 files changed, 35 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~tsileo/microblog.pub-devel/patches/37342/mbox | git am -3
Learn more about email & git

[PATCH] Add documentation about image_url and custom favicon Export this patch

Also expand documentation about custom templates
 docs/user_guide.md | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/docs/user_guide.md b/docs/user_guide.md
index 6bea721..16b7dfc 100644
--- a/docs/user_guide.md
+++ b/docs/user_guide.md
@@ -28,6 +28,7 @@ You can tweak your profile by tweaking these items:
 - `name`
 - `summary` (using Markdown)
 - `icon_url`
 - `image_url`

Whenever one of these config items is updated, an `Update` activity will be sent to all known servers to update your remote profile.

@@ -35,6 +36,15 @@ The server will need to be restarted for taking changes into account.

Before restarting the server, you can ensure you haven't made any mistakes by running the [configuration checking task](/user_guide.html#configuration-checking).

Note that currently `image_url` is not used anywhere in microblog.pub itself, but other clients/servers do occasionally use it when showing remote profiles as a background image.
Also, this image _can_ be used in microblog.pub - just add this:

<img src="{{ local_actor.image_url | media_proxy_url }}">

to an appropriate place of your template (most likely, `header.html`).
For more information, see a section about [custom templates](/user_guide.html#custom-templates) further in this document.

### Profile metadata

@@ -161,10 +171,35 @@ $secondary-color: #32cd32;

See `app/scss/main.scss` to see what variables can be overridden.

You will need to [recompile CSS](#recompiling-css-files) after doing any CSS changes (for actual css files to be updates) and restart microblog.pub (for css link in HTML documents to be updated with a new checksum - otherwise, browsers that downloaded old CSS will keep using it).

#### Custom favicon

By default, microblog.pub favicon is a square of `$primary-color` CSS color (see above section on how to redefine CSS colors).
You can change it to any icon you like - just save a desired file as `data/favicon.ico`.
After that, run the "[recompile CSS](#recompiling-css-files)" task to copy it to `app/static/favicon.ico`.

#### Custom templates

If you'd like to customize your instance's theme beyond CSS, you can modify the app's HTML by placing templates in `data/templates` which overwrite the defaults in `app/templates`.

Templates are written using [Jinja](https://jinja.palletsprojects.com/en/latest/templates/) templating language.
Moreover, `utils.html` has scoped blocks around the body of every macro.
This allows macros to be overridden individually in `data/templates/utils.html`, without copying the whole file.
For example, to only override the display of a specific actor's name/icon, you can create `data/templates/utils.html` file with following content:

{% extends "app/utils.html" %}

{% block display_actor %}
	{% if actor.ap_id == "https://me.example.com" %}
		<!-- custom actor display -->
	{% else %}
		{{ super() }}
	{% endif %}
{% endblock %}

#### Custom Content Security Policy (CSP)

You can override the default Content Security Policy by adding a line in `data/profile.toml`:

I just applied this patch, thank you! (and sorry for the delay).