statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.64k stars 234 forks source link

RSS missing feed title #1012

Closed AlexHedley closed 1 year ago

AlexHedley commented 1 year ago

I was looking at using IFTTT to post items based on an RSS feed.

I got the following error using the feed url:

http://alexhedley.com/blog/feed.rss

Not a valid feed url, missing feed title

image

Other services like Zapier have no issue.


Code:

https://github.com/statiqdev/Statiq.Web/blob/main/src/Statiq.Web/Pipelines/Feeds.cs

daveaglick commented 1 year ago

I can see the same on the W3C validation service (https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Falexhedley.com%2Fblog%2Ffeed.rss):

image

At one point these feeds we validating, so I'm not sure if there's a regression, certain settings aren't carrying through like they're supposed to, or the validator has gotten better. In any case, let me see what I can do about cleaning it up.

daveaglick commented 1 year ago

The issue here is due to a mismatch between some of the variables. The Feeds pipeline in Statiq Web attempts to set FeedTitle as the title of the feed. That allows you to override the title for any given feed from the feed YAML file. It's fine if one isn't specified though (and one is not in the Clean Blog theme's feed.yaml file for example) because the underlying GenerateFeed module will fallback to Title for the feed title, which should represent the title of the site. The problem is that Clean Blog (and probably most other themes or custom sites due to that as an example) are using SiteTitle instead of Title to set the title due to trying to establish a convention of Title as a local page title and SiteTitle as the site title, so no Title metadata gets set at all.

A quick fix for you would be to set FeedTitle globally. A longer-term fix that I'll have coming out in the next release (later this week) is to make sure the feed used SiteTitle if both Title and FeedTitle are null or empty.

daveaglick commented 1 year ago

This is now validating with the unreleased changes:

image

I did notice one more thing that's less a bug and more a documentation issue. Feeds require a valid absolute URL to validate, so specifying Host setting (I.e. in the settings.yml file) is important for valid feeds. I've added a little warning if one isn't specified and will add some documentation about this.

Otherwise, this bug will be resolved on the next release so I'll close this issue. Thanks for reporting it!

AlexHedley commented 1 year ago

Thanks for the quick response :-)