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

BlogML export/import doesn’t keep published date #378

Open
simonech opened this issue Dec 13, 2021 · 6 comments
Open

BlogML export/import doesn’t keep published date #378

simonech opened this issue Dec 13, 2021 · 6 comments

Comments

@simonech
Copy link
Contributor

If you export and import using BlogML, the info on the published date is lost.
During export the CreatedOn date is filled in with created property of Umbraco.

And during the import it is set back. But doing like this the published date, which might have set to a different date than the created date is lost.

This is an issue if posts come from another import (so the date off by years) or if the post url is in the /yyyy/mm/dd/ format so URL is not reachable any more.

There are 2 ways of solving this:

  • Set the published date on export
  • Try to fetch the publish date from the url of the post and set directly the published date

Not sure which could be the best option here

@Shazwazza: what do you think? I can do a PR but unsure of best solution

@Shazwazza
Copy link
Owner

Could both be an option?

@simonech
Copy link
Contributor Author

What do you mean "both"?
If we set the published date as createdon, the parsing of the date in the URL is not needed.

or we could check if the URL contains a date (in case the export comes from some other blog) and if it does, we use that one, otherwise we use the createdOn as published date (since the new creation date will become the date of importing)

@Shazwazza
Copy link
Owner

I just meant that if it's not exported with that date then we can fallback to attempting to parse the URL

@simonech
Copy link
Contributor Author

How would you know it's not exported? there is no "published date" property in BlogML as far as I know.
The value is stored in the createdon property, and is always there...
There is no way to know it's the actual creation date or publication date.

@Shazwazza
Copy link
Owner

Sorry I missunderstood. I thought it was added an additional exported value so we would have both a created and published date in the BlogML, but you are suggesting to changing the created date to be the published date?

AFAIK I think it's possible to add additional custom data to the BlogML (I think we do this with tags).

Else, the 2nd option of trying to parse the URL could always be the fallback if we are not certain we have a published date.

@simonech
Copy link
Contributor Author

Exactly, I'm suggesting storing the published date into the creartedon BlogML field and then setting the Published date from this field when importing.

The reasoning is that when you import it back into Umbraco, the new creation date will be the one when the import process happens. If you then re-export (like I did), you end up with 100s of posts published on the same date.

Also, imagine you have a draft sitting there for a month, and you finally publish it: in the original blog, your post will be published when you finish the post. But with the current implementation, if you export and import, the publish date will become the date when you started working on the draft, which is not what you wanted.

When I exported from Subtext ages ago, the createdon field contained the published date.

Personally, I'll set the createdon from the publish date. And in the import, check if the URL contains a date, and is different from the createdon, use that as publish date (at midnight or midday) otherwise use the correct date and time from the createdon attribute

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

No branches or pull requests

2 participants