4 ms·
There are some cases where re-writes in Go or Rust are just so good that the "originals" become almost entirely obsolete. Hugo is one of those tools, ESbuild se
by hnarn 5y ago
There are some cases where re-writes in Go or Rust are just so good that the "originals" become almost entirely obsolete. Hugo is one of those tools, ESbuild seems to be another, or ripgrep for Rust for example.
- nickjj 5y ago> There are some cases where re-writes in Go or Rust are just so good that the "originals" become almost entirely obsolete. Why's that? I use Jekyll here and even with over 500+ articles (posts + drafts) it takes around 2 seconds to get live reload feedback in Jekyll while writing. Jekyll also handles the entire asset pipeline complete with md5 tagging of assets without using Webpack or any build tools. It also lets you write plugins with a few lines of Ruby to add new template filters and other things. For example I wrote a custom Jekyll plugin that lets me write bullet lists like this after a specific type of header: - 0:45 -- Something - 1:45 -- Another thing - 1:03:31 -- And another thing And it automatically converts the timestamp numbers into clickable links that jump to that point in an audio player. AFAIK Hugo has no way to do anything like that, at least no where near as easy as Jekyll. With Hugo wouldn't I have to compile a custom build of Hugo for such a thing? But with Jekyll it was adding 1 file into a directory and writing 20 lines of "business logic code" to add a new filter. Now I just do {{ content | audioseek }} when I want clickable timestamps. I also wrote another plugin that automatically adds certain rel attributes to external links by adding {{ content | extlinks }}. Things like the above are why I continue using Jekyll because personally I haven't found another SSG that comes close to how easy it makes it to add custom behavior. I don't mind the 2 second live reload wait and I wouldn't switch away from Jekyll for a speed boost alone. At some point the speed is "good enough". Sure I would love a 100ms reload but I wouldn't give up everything else for that.
- minimaxir 5y agoHugo has one-file creation of shortcodes + config params too, which IIRC is the same workflow as doing it in Jekyll: https://gohugo.io/templates/shortcode-templates/ https://gohugo.io/templates/shortcode-templates/ Extending the Markdown rendering appears possible without building Hugo itself, albeit not for lists: https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks https://gohugo.io/getting-started/configuration-markup/#mark...
- nickjj 5y agoI'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