Guts/mkdocs-rss-plugin

Use absolute url for images in feeds?

Sieboldianus opened this issue ยท 6 comments

First, stunning plugin, thanks so much for supporting the indie web!

I've added mkdocs-rss-plugin to my blog and it worked (almost) flawlessly.
https://du.nkel.dev/

The images shown in the description do not contain the full URL:
https://du.nkel.dev/feed_rss_created.xml

e.g.:

<img alt="hifi" src="img/hifi.jpg">

.. which is why they are not shown in preview.

Would it be possible to add this full url somwhere in the settings?

Guts commented

Hi @Sieboldianus,

Thanks for your interest and your kind message :).

To help, can you share the repository behind your blog with your mkdocs configuration file please?

Hi @Guts . Yes. I had this on my personal Gitlab, pushed it here to the public:
https://framagit.org/Sieboldianus/du.nkel.dev

Guts commented

Thanks.

I've tried to set up your site locally but I can't find requirements and i'm facing missing dependencies. Would you list them somewhere please to make debugging easier?

Yes, absolutely, apologies.

Several options:

  • remove all entries from markdown_extensions in mkdocs.yml (and git-revision-date from plugins:) - this should work for simple site building, without requiring you to install all these extensions

Otherwise, here is the complete install with venv in Linux (or WSL):

# install mkdocs
apt-get install python3-venv
python3 -m venv mkdocs_test_env
source ./mkdocs_test_env/bin/activate
pip install --no-cache-dir mkdocs  markdown-include pygments \
    pymdown-extensions mkdocs-git-revision-date-plugin \
    mkdocs-git-revision-date-localized-plugin  mkdocs-rss-plugin

mkdocs serve
# remove venv
rm -rf mkdocs_test_env

Here is the way to setup/test the repository with conda (Windows, Linux, WSL etc.):

git clone https://framagit.org/Sieboldianus/du.nkel.dev.git
conda create -n mkdocs_test
conda activate mkdocs_test
conda config --env --set channel_priority strict
conda install -c conda-forge mkdocs  mkdocs-git-revision-date-plugin markdown-include pygments  pymdown-extensions
pip install mkdocs-rss-plugin mkdocs-git-revision-date-localized-plugin
mkdocs serve
Guts commented

So, maybe it requires some clarification about how the plugin handle different images:

  • you can set the channel (= the whole feed) image with the image settings. ref doc.
  • if you want an image per feed item (per page in case of blog), you need to specify the image to use within the page meta (YAML frontmatter): ref doc

From what I can see in your content, there is no specified image.

About the path to the image within page body, it's not related to the plugin but how the content is processed by mkdocs. The body is included as item description as almost raw HTML (or specified through page.meta.description).

About the path to the image within page body, it's not related to the plugin but how the content is processed by mkdocs. The body is included as item description as almost raw HTML (or specified through page.meta.description).

Ok - thank you for the clarification and for looking into this. This makes sense - in this case I'd have to either

  1. use an absolute image URL for the first image in each post, as this may appear in the clipped summary of RSS .description.
  2. or specify page.meta.image explicitly with a full image URL. page.meta.image. In this case, the relative image in the RAW description would still appear broken, but it would be shown through the page.meta.image (with e.g. image: "featured_images.png" )

I think this works for me. Many thanks! And kudos for this plugin. ๐Ÿ‘