Hello!
I want to embed the content from a feed RSS of a website (I call it B) on a page of my Hugo website (I call it A).
I tried to use <iframe>
, but it was unsuccessful.
It might be a solution to using the <iframe>
generator from some services because it works, but sincerely I would avoid external resources if they are not strictly necessary.
Any suggestion?
Take a look at transform.Unmarshal | Hugo
Thank you.
I need help, please.
I suppose that I should be store the following content:
{{ with resources.Get "https://community.nicfab.it/feeds/c/privacy.xml?sort=New" | transform.Unmarshal }}
{{ range .channel.item }}
<strong>{{ .title | plainify | htmlUnescape }}</strong><br />
<p>{{ .description | plainify | htmlUnescape }}</p>
{{ $link := .link | plainify | htmlUnescape }}
<a href="{{ $link }}">{{ $link }}</a><br />
<hr>
{{ end }}
{{ end }}
in a new file under /layouts/shortcodes.
Is it so, or do I need to store it in another file?
If you want to insert it in to content then a shortcode is what you need.
If you want to insert it in to a template you should use a partial instead.
I tried to create the file /layouts/shortcodes/rss.html
with the previous content and recall it by inputting {{ range .channel.item }}
into a post.
It doesn’t work either with {{ rss }}
.
Where am I wrong?
It will be easier if you read the shortcode documentation so you understand how they work.