DEV Community

Daniel da Rocha
Daniel da Rocha

Posted on

Static site with markdown pages, but with bits of dynamic content in it?

Hello!

I have long thought about converting my Wordpress blog into a static site with all the posts as markdown files, using either Hugo, or Jekyll, or Gridsome, etc.

However, I have a custom shortcodes in each of my posts which grab data from a database and convert it to elements in the post.

This:
shortcode

Becomes this:
rendered posts

I tried doing some research about how to make this situation work in a static site, but I in a bit of a loss as to where to start.

  • Would it still work as a static site with bits of dynamic content being called at render time?
  • Or would the dynamic content be called at build time only (which would be totally ok as well)?

So I thought I'd ask you guys: anyone with similar experiences or tips about this?

Thanks!
Daniel

Top comments (7)

Collapse
 
ben profile image
Ben Halpern

You may want to look into JAMStack architectures. I think this may be the approach you’d want to take here.

Collapse
 
tux0r profile image
tux0r • Edited

Would it still work as a static site with bits of dynamic content being called at render time?

Yes.

The relevant advantage of static sites is that there is no dynamic code on the server, leading to faster page loading and less security annoyances. This is still true when you add 45236 gigabytes of JavaScript to the part only loaded on the client side. (Sadly.)

Collapse
 
danroc profile image
Daniel da Rocha

so if all I am doing is api calls to get and display information (no mutations on server side), it should work?

Would HUGO's Data Templates be in the right direction?

Collapse
 
tux0r profile image
tux0r

Yes.

Yes.

Thread Thread
 
vitalcog profile image
Chad Windham

I enjoyed this conversation...

Thread Thread
 
danroc profile image
Daniel da Rocha

yes, very concise. But very reaffirming!! :)

Collapse
 
bgadrian profile image
Adrian B.G.

If that is the only dynamic example, probably the address of buildings will not change, so I would add them at "compile time".

For the dynamic parts like Gmaps I would leave some HTML forms/data and fill them at runtime, with JS.