Hacker News new | past | comments | ask | show | jobs | submit login

That's pretty cool! I ported my own WP blog to a static site generator (my own but with a format inspired by Hugo) a while back and hacked together a script with wpparser and some custom code to spit out markdown (it was a while back but I think just regexes). It got me the bulk of the way there but I still had to go through every page and tweak it to get everything just right. Would happily have paid $150 to avoid that.

Are you keeping URLs stable? That was tricky for me IIRC, along with RSS.

(The very trickiest bit was probably specific to me. I still have inbound links with the page in a "/?p=3" kind of query param, which I think was the WordPress default 20-odd years ago. I didn't want to make the root URL for the site non-static to handle that, so I wound up putting some JS in my index page template that checks for that kind of thing. If it spots it, it changes window.location to a specific URL that is delegated a Flask site that knows where to redirect people. Link in bio if anyone wants to see how it works. I should probably blog about it sometime!)




I actually did write this up if it helps anyone... I did something similar, my WordPress site only had ~100 pages, so I just put the page map in a table in the js: https://www.hotelexistence.ca/something-mildly-different/ (my ?p=### script is near the bottom)


> so I wound up putting some JS in my index page template that checks for that kind of thing.

If we are going to use JS, then you might as well put the redirects themselves in JS. Have a tiny stub of JS that detects the "/?p=xxx" case, which can then load the (presumably very large) list of redirects from a separate file and do the redirecting. That'll save you maintaining the extra service.

As for me, I moved from a Django app I made to a Hugo site, but it's pretty much the same deal. Because my Hugo site is on a "real" server (rather than e.g. GitHub Pages) I just have a giant pile of 500+ redirects in the nginx config file for the site (which is checked into the same repo as my Hugo site). It works for me.


That's a nifty idea! I need the extra Flask for some other unrelated stuff, so it's OK as it is, but if it was on GH pages (like you say) that would be super useful.


Thank you for saying so!

That's super awesome too, this is not so different under the hood, I used libxml for getting the content and pandoc for converting -- pandoc turned out to be by far the best of the tools I tried for that aspect.

It won't necessarily keep the URLs stable, they'll be made based on the title of the post.

That's a cool solution for the ?p=<id> issues, this doesn't handle it but when I've done it for for sites I host I usually use nginx's rewrite rules. I think for query rewriting you need to additionally use the map directive, but I was only handling directory vs .html and things like that.

Thank you again for commenting, I like your site!




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: