3 ms·
I'm not sure if either of the things you linked would solve this specific problem but I also only skimmed the pages you linked. For example the Jekyll plugin f
by nickjj 5y ago
I'm not sure if either of the things you linked would solve this specific problem but I also only skimmed the pages you linked.
For example the Jekyll plugin for the timestamps:
1. Looks for a specific type of post and then it scans the body of the post
2. Looks for a specific header on the page and then grabs the list right after that header using an xpath selector (no special classes needed)
3. Goes through all of the elements in the list
4. Parses out the timestamp from the line and changes the timestamp into a link with a data attribute containing a specific timestamp format
The code for this is here: https://github.com/nickjj/runninginproduction.com/blob/master/_plugins/jekyll-audioseek.rb#L21-L37 https://github.com/nickjj/runninginproduction.com/blob/maste...
There's no custom Markdown or even classes added to the list or post because it lets you naturally write your Markdown list how you would if the feature didn't exist, and the plugin's goal is to add in that new behavior behind the scenes. This lets me keep all of my posts really clean[0].
It would be super interesting to see a Hugo equivalent for the audio_seek custom filter. I don't expect you to spend your Sunday afternoon writing such a thing but it would be cool to see a direct comparison of how you would implement it with Hugo. It might get more folks to move to Hugo too, because the main thing that keeps me using Jekyll is the ability to create adhoc customizations without needing to fork Jekyll.
[0]: https://github.com/nickjj/runninginproduction.com/blob/master/_posts/podcast/2021-05-10-82-dropbox-gives-you-secure-access-to-all-of-your-files.md#topics-include https://github.com/nickjj/runninginproduction.com/blob/maste...
- minimaxir 5y agoThat particular example could theoretically be replicated with rendering the content to HTML via .RenderString (https://gohugo.io/functions/renderstring/ https://gohugo.io/functions/renderstring/) + replaceRE (https://gohugo.io/functions/replacere/ https://gohugo.io/functions/replacere/) + an ugly regex, with a layout override to call that modified filter instead of the normal content. Not 100% sure if that would work, but on paper business logic LOC would be about the same and using a regex is the more canonical way to handle this sort of processing anyways.
- edoceo 5y ago> using a regex is the more canonical way Yuck. I also ran into similar issue with Hugo, where I'm out of the happy-path. Those short codes didn't work, complex processing of some unique bits of content was easier in Jekyll (but also other script-lang based tools) than it was in tools like Hugo.
- nickjj 5y ago> with a layout override to call that modified filter instead of the normal content Would it apply to all content in a specific layout or only specific bits of a certain layout? With the way I have it set up with Jekyll, only a specific post gets the audioseek timestamps added to it, because I wouldn't want it to apply to all lists on the site. I also happen to share a single layout for both podcasts and interviews and interview lists shouldn't get processed with audioseek'd timestamps. With Jekyll this is super easy to pull off because it's only a custom filter. It can be applied to the specific content I want without having to worry about layouts.