问题
Amazon S3 has static website hosting, but does not support tags like:
<!--#include virtual="i/header.htm" -->
<!--#echo var="i/header.htm" -->
<!--#include file="i/header.htm" -->
Is there anyway to mimic this functionality without having some sort of JavaScript/AJAX content request for the header on every page on S3?
回答1:
You could use javascript to assemble the page in the client browser. With jQuery:
$('#header').load('header.html');
This has a serious SEO drawback-- search engines like Google won't see the final page.
You could also embed content in the page as an iframe.
回答2:
Amazon S3 provides flat file storage. Whatever logic you apply needs to be client-side.
来源:https://stackoverflow.com/questions/6776359/server-side-include-on-s3