Hacker News new | ask | show | jobs
Show HN: Personal Site, and the Static Site Generator I Wrote to Build It
13 points by ggoss 2552 days ago
Hi HN,

This one's a twofer.

First, I'm showing off my personal site and blog, garrettgoss.com [1]. I'm looking to make a career change — from biomedical engineering/biomedical research, to research and development engineering in the consumer product development/additive manufacturing space — and felt that my prior work experience inadequately reflected my true interests and skills, which are better exemplified by my side projects. I put this together for myself, to better document my own work, for the broader internet, to share some of the projects I've developed to those who might be interested, and for potential employers, to help demonstrate that I am more than what my resume might suggest. I'm interested to hear your thoughts on how I did with the latter two goals, as well as any suggestions you might have for doing better.

Second, I'm showing off the static site generator I made to build it, which I wrote about in a blog post here [2], and is available on GitHub here [3]. I know that these are a dime-a-dozen around here, but I didn't love any of the others (and wanted greater configurability), so I made my own. After writing a new post (or making edits to an existing one, or making changes to any of the templates), I regenerate the above site with a single line `python3 sitegen.py`, preview it locally (handled automatically), and sync the changes to Amazon S3 (again with a single line) via their command line interface. I still aim to move some things around a little bit in the code (which is why I bulk import everything in `__init__.py`), but it's functional and (IMO) reasonably well documented. If you happen to take a look, I'd love to hear your comments about it as well.

Thanks!

[1] https://garrettgoss.com

[2] https://garrettgoss.com/blog/2019/05/sitegen.html

[3] https://github.com/ggoss/sitegen

4 comments

Can you expand more on why none of the existing static site generator solutions were adequate?

> Write posts using Markdown with YAML metadata

[1] Hexo does exactly this...

Writing your own static site generator would be a great learning experience though

[1] https://github.com/hexojs/hexo

You aren't wrong — indeed, many static site generators are capable of doing exactly that — but I wouldn't go so far as to say that no other existing solutions were adequate.

As for Hexo, it looks like a great option, but it's written in Javascript — a language and ecosystem that I'm not terribly familiar with. While I could certainly learn it, doing so specifically to use Hexo (which I'd then need to configure, and possibly extend to my liking) adds an extra yak I'd need to shave to get started. I'm sure I could use it without learning Javascript, but troubleshooting or extending it would be more difficult, and I'd still need to adapt to the workflow it was designed around.

I was looking for a static site generator with all of the features I knew I wanted (like table of contents generation and seamless image compression/scaling), and all of the features I didn't yet know I wanted (like specified/fixed table column widths), so it needed to be easily extendable. I also wanted to get off the ground quickly, so it needed to written in a language that I was already comfortable with. Lastly, and most subjectively of all, the workflow needed to feel right.

Ultimately, it came down to the choice of (a) spending my time learning how to adapt to someone else's ideal solution, or (b) spending my time creating my own (or something like it). I chose the latter, and like you said, it was a great learning experience.

Thanks for taking the time to have a look.

Thanks for the detailed reply! I understand now. There's a huge overhead to learning a new framework/language/ecosystem and it might not even meet the requirements you need.

Even if there's something that's good enough, I still like that people go through the process of making their own system. Completely fresh approaches are great way to learn and appreciate the time that goes into a framework and how hard it is to achieve; extensibility, performance, flexibility, security...etc

I had a quick look at the Github and it's great to see how concise and easy to follow the framework is, that's a lot harder with older Frameworks like hexo.

Anyway hope you keep developing it further!

Many thanks! I'll definitely keep working on it, albeit a bit more slowly now that the blog is up and running.

Next, I'd like to make improvements to navigation and article discoverability on the site; I'm not yet sure what changes I'll make to the generator to accomplish this, but I'm sure there will be some (if you have any suggestions, I'd be glad to hear them). After that, we'll see!

Thanks again for having a look!

I am also building one link[1] but for processing jupyter notebooks to responsive html primarily. You can also refer to this blog[2] to generate html from ipynb file.

1. https://github.com/hemanta212/blogger-cli/tree/add_templatin...

2. https://nipunbatra.github.io/blog/2017/Jupyter-powered-blog....

My site. https://hemanta212.github.io/blog/

Thanks for the note. Looks good!

Blog post generation from Jupyter Notebooks is definitely something that I plan to add to mine. Hopefully `nbconvert` and my Jinja2 templates get me 90% of the way there; having yours as a reference will be useful if anything really trips me up.

Taking a look at your blog post, don't forget that Bootstrap has a lot of classes built in that make prettifying things like tables really easy [1]. In Sitegen, I apply a few Bootstrap classes to all tables in the BeautifulSoup object like so:

  for table in soup_body.find_all('table'):
      table['class'] = 'table table-striped table-sm table-hover'
  return soup_body
Refer to the `add_table_tags` function here [2] to see what I did directly.

[1] https://getbootstrap.com/docs/4.3/content/tables/

[2] https://github.com/ggoss/sitegen/blob/master/sitegen/md_proc...

I can attest to how rewarding this can feel. I wrote a static site generator for my site as well[1] and it looks like both of us have a lot of common goals. I agree with you in that a lot of the existing SSGs are bloated out of the box and do not really focus on optimising the end output to site visitors. Gatsby is the only exemption to this but writing my blog in JSX isn't too appealing.

[1] https://github.com/astronomersiva/lego

Great work! I like your site quite a bit - both in appearance and content. I'll have to take a closer look when I get the chance.

It's pretty cool that, despite using different languages and implementations, we converged on fairly similar outputs. That said, I may need to borrow some ideas from yours!

This looks great! I'm a big fan of the 3d printer (off tpic, I know) but building my own custom 3D printer has been one of my most technically rewarding experiences.
Thanks, glad to hear!