Joe
Joe

Reputation: 8292

method to maintain common sections in .html templates (e.g. header, footer, etc.)

Is there a method available to make maintaining the common sections in html templates (e.g. header and footer) easier?

I am trying to explore a javascript multi-page app.

In PHP, my approach for better code maintenance is to use require_once(path/to/header) and simply adjust the code in path/to/header, no need to update all pages that use the header.

Is there a similar method for that to maintain html templates? I know this can be achieved in javascript, but I was thinking of a non-dynamic method for this, for search crawlability sake. Although I have read that google can crawl javascript apps, I decided not to make the app 100% javascript generated, I want to maintain the few common sections as static html.

Anyway, what is a common approach for this scenario? Is there a compiler or something? Because right now I am thinking to build the pages in PHP and then just get the html ouput when I move the code out of development.

Any suggestions?

Upvotes: 0

Views: 32

Answers (1)

Artur P.
Artur P.

Reputation: 896

Search: javascript html template engines:

https://colorlib.com/wp/top-templating-engines-for-javascript/

Eg.

  • pug
  • ejs
  • Handlebars

Upvotes: 1

Related Questions