Closed BrunoVernay closed 4 years ago
I tried to find a RegEx that could remove the non-significant "-index" at the end. But I could not find one. This is why I ended up tweaking the getPostFilename() in PostUtils. Not the best design ... it may come as a surprise later for other use cases. If not RegEx, it would be very easy to remove an eventual "-index" in a string. All this code should be close together ideally. If you point me at some design I could try out better options.
This solution is totally fine, I'm already doing a very similar thing in the Wiki plugin too.
Also, the functionality is working great, thank you for your help! The only question I have is not related to the functionality: you mentioned the /Year/DaysOfYear-title/index.md
format is a Gatsby-style foramt, but I haven't ever really used Gatsby and can't find documentation for that with a quick search. Could you find me a link to documentation or examples from Gatsby, or add some brief documentation to the OrchidPosts/README.md
describing this new format?
Ok, after searching, my only conclusion is that Gatsby does not care about folders and file names. It will take everything and use the frontmatter to get the information. The format seems to be mine https://gitlab.com/km-brnvrn/static-site/-/blob/master/new-post.sh like a compromise to get some structured folder organisation and ease of use.
From Orchid point of view, I may have added unnecessary complexity. Yet the current code put a constraint on the folder/file organization ...
For me, I could write a script that take my format on one side and create the Orchid expected files on the other.
I'm OK with the additional complexity here; the regex itself is just an implementation detail, and I like the idea of relaxing the strict requirements on the filename structure. The main thing I want to make sure to keep is to determine the post date from the filename instead of from the Front Matter.
Thanks again for your work on this. I'm working on finishing up release notes for the next version now, and should hopefully have this all released sometime today.
Accept /Year/Month/Day/Title/index.md and /Year/DaysOfYear-title/index.md (typically used in Gatsby)