-
Notifications
You must be signed in to change notification settings - Fork 333
WordpressDotCom: put downloaded assets into /year/month subfolders to reduce clashes #436
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
Conversation
ashmaroli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor edits required..
Co-authored-by: Ashwin Maroli <[email protected]>
…thod signature intact. Guarded it with an if statement, so it should also be safer than the original.
|
Pulled date subfolder logic earlier in execution chain. This keeps method signature intact. Guarded it with an if statement, so it should also be safer than the original. Tested it on a fresh import of 161 posts with 837 images. |
|
Thanks for your patience on this PR. As I mentioned, I've never used Ruby. So your assistance has been appreciated. |
Yes, that's the reason I walked you through this. I did not merge this yet because I'm not sure if everyone would want their assets put into this particular subdir path. |
parkr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a reasonable addition for new imports! I like that there is some date information preserved, and that it will be familiar for people from WordPress, since this is how WordPress organizes images too.
|
@jekyllbot: merge +fix |
|
Thank you @DavidBurela |
This PR resolves #435
A small change to put downloaded assets into /year/month subfolder. This is done by using the date of the post as the subfolder in the assets folder. This keeps the assets chronologically with the post, and reduces clashes as this is the same as how Wordpress store their files.
Before:
When I ran the import tool on my blog, I had 350 clashes of images being overwritten.
After:
I successfully ran this on my blog https://DavidBurela.wordpress.com, which has 13 years, 230 posts. I only ended up with 5 clashes (which was due to me referencing images in other posts).
Note: I have never coded in Ruby before. I naively implemented it with the smallest number of changes that I could to reduce bugs.