StevieB StevieB - 4 years ago 109
React JSX Question

Adding Blog Content/Static files to existing Preact.js website

I currently have an existing Preact JS site set up but want to add blog section.

So basically easy way to add new pages and routes.

I.e. blog/content-1, blog/content-2


I know I could easily create these pages and routes manually but is there something better out there that fits into existing sites ?

I.e. a lot of the static site generators I see out there, basically you need to run from the start and they generate a new site.

But in my case I just wish to add an extra section to my site which will be the static blog entries, not sure what the best tools out there for this is ?

If any ideas or suggestions would be great.

Answer Source

The preactjs.com website is built exactly how you are wanting to build this. It's open source: https://github.com/developit/preact-www

Basically, fetch your HTML content via Ajax (however you'd like), then render.it as Virtual DOM using preact-markup.

For a real-world example, here's how preactjs.com does that: https://github.com/developit/preact-www/blob/master/src/components/content-region.js

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download