Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
From Jekyll to Hugo: my experience as a noob in web development (giuliomagnifico.blog)
3 points by giuliomagnifico on Aug 5, 2024 | hide | past | favorite | 4 comments


> So, I decided to create a redirect on Nginx for each old URL, pointing to the new one. It was quite frustrating to write all those redirects…

You can use a regular expression to write a single redirect for all the posts. Something like the following could do the trick:

  location ~ ^/(home|networking|misc|tips)/(\d{4})/(\d{2})/(\d{2})/([a-zA-Z0-9-_]+)\.html {
    return 301 https://giuliomagnifico.blog/post/$2-$3-$4-$5/;
  }


Damn! I didn’t know that Nginx handles regex! Thank you. This would have saved me quite a bit of time… but I already did it.


What is "with Hugo you make changes only inside the folder of your current theme, and then by recompiling the site, the changes are “executed” on the folders and files inside the public part of the site" supposed to mean?

In both Jekyll and Hugo your templates are separate from your posts.

And before switching static site generators because "the structure of the URLs linking to each article is much simpler and more convenient", maybe read the documentation: https://jekyllrb.com/docs/permalinks/

You can have the exact same URL scheme in Jekyll.


With Hugo, all the files needed to modify the external look of the site are inside the theme folder. That's a bit different with Jekyll.

About the URL: I didn’t know that, thanks. When I installed Jekyll, it was already set up with this URL scheme. Same for Hugo, it’s fhe default behavior, but it has a better scheme by default.

As a noob, I didn’t check this when I started with Jekyll years ago. Maybe the devs should change the default scheme. But the issue with the URL scheme isn't the date, it's that if you change the category of a post in Jekyll, it changes in the old posts too. And I don't understand if you can omit the category, all the examples in the documentation include it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: