-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
routeDiscoveryDone Type and Order Posts #15
Conversation
I'm working on getting the tests fixed on this. |
Updated the docs to show how to actually use the plugin currently changed the check for certain attributes on the route data only include routes that include /blog or the provided slug from the config
I think the last error is unrelated to the changes I've made, but I'm trying to hear back from the Scully Team. |
I figured out what the last error is. The last error is that when the RSS feed is to be written, the |
@pjlamb12 thanks for looking into improving the RSS feed plugin!! I tried it out locally as well and for some reason the Here is an example for another |
Changing the plugin to Markdown Frontmatter ---
title: Food
description: Food description
publishedAt: 2020-03-25T10:12:00.000Z
updatedAt: 2020-03-25T10:12:00.000Z
published: true
tags: [lazy-images]
authors:
- Bruce Lee
---
# Food HandledRoute in
|
Changing the format of the date in the frontmatter like ---
title: Food
description: Food description
publishedAt: 2020-03-25T
updatedAt: 2020-03-25T
published: true
tags: [lazy-images]
authors:
- Bruce Lee
---
# Food It is correctly available in the plugin
However, now it is not an valid date string. |
@marcjulian yeah, but if you change the dates to strings, just by wrapping them in quotes, then the string value comes through to the plugin. But the RSS Feed npm package then fails because it can't call a function on the string. |
Okay as string it is correctly parsed to the plugin. That leaves us to the question why is the date not correctly available during the plugin process if it is not a string. I saw your discussion in Scully Gitter. What if the date is a string in the front matter and the plugin transforms that string into a date for the RSS Feed package? |
I thought about that, but it felt like a bad workaround. The dates shouldn't be empty objects and finding the solution there felt better. But I'm open to whatever. If we can't figure out what's going on in scully, I guess we'd have to do that. |
Yes building a workaround doesn't feel right, would be better if scully doesn't parse the dates as empty objects. Let's see if we can find something out with scully. If that doesn't work out we could start over with the workaround. What do you think would be the best approach? |
I think the best workaround approach would be having those dates be strings, like:
And then in the
What do you think? |
Yes sounds good. What if we want to keep the time as well?
And then we use for example dayjs to convert it to a date
|
That would be great too. Works for me. |
I just tried it out and it would work with dayjs like so
|
what happens if |
I think dayjs would be fine either way with the string or the actual date object. |
Maybe we should just go ahead and add dayjs and the plugin would work either way and the release could be done. |
I tried it out on the
I installed dayjs and wrapped the date as described above and it works fine. |
Do you want to add dayjs to the plugin and push again? |
Yes I will do that. |
Thanks for looking into this 💯 much appreciated! |
How do I import dayjs into the plugin's rss.js file? I npm installed it, and required dayjs at the top but that isn't working. |
const dayjs = require("dayjs"); |
use dayjs to convert strings to dates, or date objects to dates, for the rss plugin added dayjs as a dependency for the plugin added myself as a contributor to the plugin
Do you mind adding |
Yes might be because of tailwind which is added to the root dependencies. Let me have a look, sorry for the inconvenience |
The log output was just pushed. |
@pjlamb12 thanks for this PR. I will merge it tomorrow and update the readme about the breaking changes and the new config option. |
Sweet! I was just thinking, I wonder if we should add a line in the README about putting the dates in strings for now. |
Just a heads up, here's a fix in Scully for this issue: scullyio/scully#1140 |
@pjlamb12 awesome 💯 ! We can wait for it to be release and than we can remove dayjs and not introduce a breaking change. |
Although it will still be a breaking change since it's not a render plugin anymore, right? |
Yes true. I will make that clear anyways and it will require at least |
@pjlamb12 thanks for your help!! 👍 new PRs are always welcome. |
No problem, glad to help, and I'm excited to implement this in my own site! Thank you for creating the plugin and finishing up the pr! |
Your welcome. Release is published! I bumped it to 1.0.0 as it is a new plugin type. If you find anything missing in the readme or anywhere let me know! |
feat: convert to routeDiscoveryDone
Convert the plugin to use routeDiscoveryDone instead of render so it runs once instead of once per route
add the option to order by newest first or oldest first
Scully doesn't seem to pass the dates for the route data correctly. The dates are an empty object. I have asked on Gitter/Discord for clarification on this.
Breaking Changes Plugin won't be run as a postRenderer for a route
Closes #13 and #14