服务器端包括替代 [英] Server side includes alternative

查看:17
本文介绍了服务器端包括替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 GitHub 页面 上托管了一个静态站点,该站点的规模开始扩大.通常我会使用服务器端包含 (<?php include('path to file'); ?>) 来引入页眉、页脚和任何导航文件.但是 php 不能在 GitHub Pages 上运行.

I have a static site hosted on GitHub Pages which is starting to grow in size. Normally I would use server side includes (<?php include('path to file'); ?>) to bring in header, footer and any navigation files. However php doesn't run on GitHub Pages.

采用一种 iFrame 技术的 HTML5 嵌入是我唯一的选择吗?

Is HTML5 embedding which adopts a sort of iFrame technique my only option here?

我见过诸如this这个这个a>, this 但是它们似乎不适用于 GitHub 页面.

I have seen threads such as this, this, this, this however they do not seem to apply for GitHub pages.

不太理想.

谢谢.

推荐答案

Jekyll 是一个对此的常见解决方案.它是一个静态站点生成器,允许您使用 液体模板,并且是 在 GitHub 的服务器上运行.

Jekyll is a common solution for this. It is a static site generator that allows you to use Liquid templates, and is made to run on GitHub's servers.

Twitter Bootstrap,它使用 header.htmlfooter.html 的包含:

A great example of the {% include %} feature can be seen on the documentation pages from Twitter Bootstrap, which make use of includes for header.html and footer.html:

这篇关于服务器端包括替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆