monal-im / monal-im.org

Hugo Website
MIT License
4 stars 1 forks source link

Make remoteImage shortcode use resource urls defined in page frontmatter #63

Closed tmolitor-stud-tu closed 4 weeks ago

tmolitor-stud-tu commented 1 month ago

Why is the weblate.svg defined in the config.yml rather than in the frontmatter of the page using it? Using the frontmatter seems more straightforward and maintainable to me (but I don't know if that is doable).

Feel free to close this issue if that's not easily doable.

wiseweb-works commented 1 month ago

I missed that part in post.md file @tmolitor-stud-tu . I was asking myself why "name" and "alt" parameters are defined even though they are not used. Actually you defined it as front matter. Ok, I will take a look and see what I can do.

Edit: I reconfigured the shortcode to work with Page/Post params (bb9ae81ab9f771d17b26a7e85f83e3cb80f3cb8e) . As an example, we can enter multiple external image information, not just weblate.svg. The img_url and img_title parameters are subparameters of the other parameters. The parameter hierarchy is as follows: params --> image_name --> img_title and img_url

---
title: "Support"
date: 2022-03-12T10:01:54+01:00
params:
  weblate.svg:
    img_url: "https://hosted.weblate.org/widgets/monal/-/multi-auto.svg"
    img_title: "Detailed translation status"
  image2:
    img_url: "URL"
    img_title: "TITLE"
tags: []
author: "Monal"
---

Is it better now?

tmolitor-stud-tu commented 4 weeks ago

Yes, that's perfect, thanks! :)