Multiple pages have duplicate html code, how to solve it?

it"s a bit redundant to write every page once. How do you usually solve this problem?


what technology stack do you use? Different technical solutions don't make sense at all?


you can try gulp + gulp-ejs (or other template engine). Split the reused code into fragments, then piece together fragments on different pages like <% include.. / public/header.ejs% > , and finally build a HTML page using gulp.


several methods introduced in the public part of the summary page


if the Vue is useful, pull it out directly to make a public component, and quote it directly


you can extract the same part as a separate template file.
introduce special tags such as < tpl id= "footer" / >
parse the html tag through js, get the id, of tpl and send a request to get the template file according to this id, and then replace the tag with template content


pjax to learn about it.


extract the parts that may be reused and write them as common components
which page needs to be import and then define it in components


met before, small company,

  1. former colleague code is solved with iframe , but bug is more obvious.
  2. when I was developing, I still used iframe , but before launching, I extracted the code and put it in a separate js, such as

    .
      http://liuxiaojun.win/2019/01.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea288a-1be7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea288a-1be7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?