Is it possible to categorize partial pages in static html5 pages

A static website is currently being created for a collage project. I would like to render the sidebar as partial.

I know how to do this with Ruby on Rails, but I donโ€™t know how to set it up on a static page as we are only using html5, css and javascript out loud. Doing partial work will improve speed and keep your code clean.

If shown in html with Ruby on Rails

<%= render "shared/menu" %>

      

What would my line look like without a rail system.

Any help is greatly appreciated.

+3


source to share


2 answers


I believe if you look at something like HTML Imports it might solve your question. It offers great flexibility and reusability. You declare your partial imports by simply adding:

<link rel="import" href="/shared/menu.html">

      



to the html page.

+4


source


I would suggest using the Middleman Static Site Generator. This is ideal if you just want to create a static site and it is written in Ruby. Their homepage is disabled, but I linked their github page which has instructions on how to set it up.



Once configured, the code to render the partial files will be <%= partial shared/menu %>

+1


source







All Articles