Discussion:
[hakyll] Snapshot tutorial doesn't relativize URLs before saving snapshot
Andrew Semler
2016-04-01 04:23:06 UTC
Permalink
Hi All,

When following the snapshot tutorial an how to create a RSS feed, if you
have URLs in your posts (e.g to images hosted on your site) the links will
not be relativized. This isn't a problem if the site is available at "/"
but if it's available on a path (e.g foo.com/blog/) then the links won't
work in the generated RSS feed. For me the problem occurred when I had
images in a blog post. They showed up as broken images or blank in feedly.

My solution was to make an additional call to relativizeUrls before taking
the snapshot. This may not be the best way to do it though as it has two
calls to relativizeUrls. It didn't seem to break anything else on my site.
I think the documentation should be updated to show the best way to do
this.

I tried to make a post here last night. It's possible I was either too
tired to actually click post or it had too many links and was classified as
spam, but it didn't show up for me this morning and hence I am not putting
any links in this email. I can provide links to my repo/site if required.

Thanks,
Andrew
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jasper Van der Jeugt
2016-04-01 11:01:34 UTC
Permalink
Hey Andrew,

Thanks! I will fix the tutorial.

I have the google group set so I need to manually approve new authors.
I don't really like this at all, but there's often spam in there so I
think it's the only solution for now, since I absolutely don't want
subscribers to get any spam.

Peace,
Jasper
Post by Andrew Semler
Hi All,
When following the snapshot tutorial an how to create a RSS feed, if you
have URLs in your posts (e.g to images hosted on your site) the links will
not be relativized. This isn't a problem if the site is available at "/" but
if it's available on a path (e.g foo.com/blog/) then the links won't work in
the generated RSS feed. For me the problem occurred when I had images in a
blog post. They showed up as broken images or blank in feedly.
My solution was to make an additional call to relativizeUrls before taking
the snapshot. This may not be the best way to do it though as it has two
calls to relativizeUrls. It didn't seem to break anything else on my site. I
think the documentation should be updated to show the best way to do this.
I tried to make a post here last night. It's possible I was either too tired
to actually click post or it had too many links and was classified as spam,
but it didn't show up for me this morning and hence I am not putting any
links in this email. I can provide links to my repo/site if required.
Thanks,
Andrew
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jasper Van der Jeugt
2016-04-01 11:46:19 UTC
Permalink
Actually, it seems like it is not recommended to put relative URLs in RSS feeds:

https://validator.w3.org/feed/docs/warning/ContainsRelRef.html

Perhaps the best approach is to:

1. Store the snapshot before applying `relativizeUrls`
2. In the code generating "rss.xml", use `withUrls` to absolutize URLs of posts
3. Pass them to renderRss

Peace,
Jasper
Post by Jasper Van der Jeugt
Hey Andrew,
Thanks! I will fix the tutorial.
I have the google group set so I need to manually approve new authors.
I don't really like this at all, but there's often spam in there so I
think it's the only solution for now, since I absolutely don't want
subscribers to get any spam.
Peace,
Jasper
Post by Andrew Semler
Hi All,
When following the snapshot tutorial an how to create a RSS feed, if you
have URLs in your posts (e.g to images hosted on your site) the links will
not be relativized. This isn't a problem if the site is available at "/" but
if it's available on a path (e.g foo.com/blog/) then the links won't work in
the generated RSS feed. For me the problem occurred when I had images in a
blog post. They showed up as broken images or blank in feedly.
My solution was to make an additional call to relativizeUrls before taking
the snapshot. This may not be the best way to do it though as it has two
calls to relativizeUrls. It didn't seem to break anything else on my site. I
think the documentation should be updated to show the best way to do this.
I tried to make a post here last night. It's possible I was either too tired
to actually click post or it had too many links and was classified as spam,
but it didn't show up for me this morning and hence I am not putting any
links in this email. I can provide links to my repo/site if required.
Thanks,
Andrew
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...