Hacker News new | ask | show | jobs
by dewey 857 days ago
My first reaction was to think that someone is re-inventing the wheel again for not good reason, but as usual "it depends".

If you are trying to have your blog as your main website and not just one sub-category it makes sense to use a blogging framework (Hugo, Ghost, Wordpress etc.), but I realized that having a blog integrated in a product isn't so straight forward if you want to keep your existing footer, header, CSS and share it.

I tried to use Hugo to integrate a blog in my Rails app but it was a bigger amount of pain than just doing it quickly in your existing code base with all the tools and styles already available.

3 comments

> if you want to keep your existing footer, header, CSS

That's actually pretty simple, and is what CSS is meant to be helping with - there will be a pain of having to wrangle the framework's HTML to fit what you need, but it's doable, and a small price to pay for the benefits the tried-and-tested framework brings.

Yes, but in reality it's not that easy if you want to have a shared footer / header / navbar component.

If you want to use for example Tailwind CSS classes in your blog you also need to integrate it with your build pipeline to add/remove unused classes from the final stylesheet.

I have client side includes using a custom element, that I can add to any HTML page and get the shared footer, header, etc.
I'm currently facing the same problem - adding a blog to a Rails app.

I thought Sitepress looks interesting, as its supposed to integrate with Rails. Have you given that one a try?

https://sitepress.cc/

I haven't seen that one yet but it looks good and kinda what I was looking for. Thanks for sharing!

I expected there to be many solutions for this problem but wasn't able to find a simple one.

In the end I just generated a simple "post" model and have some ugly admin interface that allows me to paste some markdown into a small box and publish it. Then I'm just using some gems for RSS feed / sitemap handling.

If you natively work with Markdown, consider the static site generation approach. It also means that your content is also source-controlled.

Basically, just convert your markdown to HTML, and dump that into your existing templates.

I use Hugo to generate HTML without header and footer etc. and serve the HTML parts from my app.