Comment

Comment by petepete

100% this, there's no good reason to do this in JS.

Apache has supported Server Side Includes forever. All you need to do is drop an 'include' in your HTML file and Apache will inject the contents in the right place.

    <!--#include virtual="/header.html" --> 
I don't know for certain but suspect other webservers will have similar functionality.

https://httpd.apache.org/docs/current/howto/ssi.html

Edit:

IIS: https://docs.microsoft.com/en-us/iis/configuration/system.we...

Lighttpd: https://redmine.lighttpd.net/projects/1/wiki/docs_modssi

Nginx: https://nginx.org/en/docs/http/ngx_http_ssi_module.html

Tomcat: https://tomcat.apache.org/tomcat-7.0-doc/ssi-howto.html

Jigsaw: https://www.w3.org/Jigsaw/Doc/User/SSI.html

parent petepete 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton