Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubDate in RSS feed is wrong #394

Closed
ksdhans opened this issue May 12, 2016 · 8 comments
Closed

PubDate in RSS feed is wrong #394

ksdhans opened this issue May 12, 2016 · 8 comments
Labels

Comments

@ksdhans
Copy link
Contributor

ksdhans commented May 12, 2016

The date that ends up in the RSS feed is the post's creation date, and not its publish date. I've worked around this by creating a custom RSSFeed.ss template that replaces:
<% if $Date %>$Date.Rfc822
<% else %>$Created.Rfc822<% end_if %>

with the following:
<% if $PublishDate %>$PublishDate.Rfc822
<% else_if $Date %>$Date.Rfc822
<% else %>$Created.Rfc822<% end_if %>

This works, but it would be better if it worked correctly out of the box.

@dhensby
Copy link
Contributor

dhensby commented May 12, 2016

Would you mind opening a PR?

@ksdhans
Copy link
Contributor Author

ksdhans commented May 13, 2016

Not so fast. I could transfer my RSSFeed.ss changes to the main RSSFeed.ss, but that's in silverstripe-framework, and not the blog module. Is modifying RSSFeed.ss in the core really the correct solution for a blog problem?

@dhensby
Copy link
Contributor

dhensby commented May 13, 2016

You can add a template to another module and it should override the framework one

@micmania1
Copy link
Contributor

micmania1 commented May 14, 2016

I think we'll need a separate template for this. If we overwrite the existing template in Blog then it will affect all RSS feeds which isn't what we want.

If you can create/copy the RSS template from framework to a custom template (ie. BlogRssFeed.ss) in blog, but with the date updated to PublishDate then you can use `$rss->setTemplate('BlogRssFeed') here: https://github.com/silverstripe/silverstripe-blog/blob/master/code/model/Blog.php#L1052

@ksdhans
Copy link
Contributor Author

ksdhans commented May 14, 2016

What about adding a getDate() method that returns PublishDate? RSSFeed.ss will use Date if it exists.

@dhensby
Copy link
Contributor

dhensby commented May 14, 2016

Either of those suggestions are good.

@tractorcow
Copy link

What about adding a getDate() method that returns PublishDate? RSSFeed.ss will use Date if it exists.

Please PR anyone. :)

micmania1 pushed a commit to micmania1/silverstripe-blog that referenced this issue May 31, 2016
micmania1 pushed a commit to micmania1/silverstripe-blog that referenced this issue May 31, 2016
@micmania1
Copy link
Contributor

See #403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants