I want to curate some news headlines from a local news site but most of its RSS feeds in the format https://www.example.com/rss/foo.php
. Can Hugo unmarshal that?
If it’s really php inside I’d rather think no it cannot
Maybe this : transform.Unmarshal | Hugo
Or
Adding audio/mpeg to mediaTypes allowlist does not seem to work
But using php file download may be blocked by security settings.
A link to the php RSS feed would help to check
That’s just an URL pointing to a PHP script. Which should deliver valid RSS, which in turn Hugo can unmarshal. A useable example might be helpful.
It’s xml, but
foo.php
Summary
<rss version="2.0">
<channel>
<lastBuildDate>Wed, 03 Jul 2024 12:32:05 -0700</lastBuildDate>
<title>Foo Feeds</title>
<link>https://example.com/rss/foo.php</link>
<language>en-us</language>
<copyright>Foo</copyright>
<generator>PHP/8.1.26</generator>
<pubDate>Wed, 03 Jul 2024 12:32:05 -0700</pubDate>
<atom:link href="https://example.com/rss/foo.php" rel="self" type="application/rss+xml"/>
<ttl>10</ttl>
<image>
<title>Foo Feeds</title>
<link>https://example.com/rss/foo.php</link>
<url>
https://example.com/assets/images/logo.png
</url>
<description>
We deliver breaking news from across the globe and information on the latest top stories.
</description>
</image>
<description>Foo Newspaper</description>
<item>
<title>
Rat Eats Mice at the Carnival
</title>
<guid isPermaLink="false">
https://example.com/rat-eats-mice/
</guid>
<pubDate>Wed, 03 Jul 2024 11:31:28 -0700</pubDate>
<description>
Rat ate mice veni vidi vici lorem ipsum.
</description>
<link>
https://example.com/rat-eats-mice/
</link>
<dc:creator>Foo Digital</dc:creator>
<media:content url=" https://example.com/image/rat.jpg"/>
</item>
</channel>
</rss>
If it’s XML:
Referring to my original question…file extension is PHP but the content inside it is XML. See my previous comment.
I don’t understand the problem. If you get the remote resource, you should receive XML. Which you can unmarshal.
If you get the remote resource and receive PHP, the server on the other end is misconfigured. It shouldn’t deliver PHP.
You are right. I just got hold of a PC to test and it worked. transform.Unmarshal | Hugo
<ul>
{{ range $data.channel.item }}
<li><a href="{{ .link | safeHTML }}">{{ .title }}</a></li>
{{ end }}
</ul>
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.