将HTML插入Jekyll帖子 [英] Insert HTML to Jekyll post

查看:179
本文介绍了将HTML插入Jekyll帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Jekyll帖子中加入一些Web Audio API HTML5代码。这里是我要包含的HTML页面+ Javascript代码的克隆:

I'd like to include some Web Audio API HTML5 code into a Jekyll post. Here's a clone of the HTML page + Javascript code that I'd like to include:

view-source: http://www.smartjava.org/examples/webaudio/example3.html

view-source:http://www.smartjava.org/examples/webaudio/example3.html

应该如何实现?

推荐答案

实际上,如果您使用markdown来创建帖子,可以使用Liquid的 include 标签。

Actually, if you are using markdown to create your posts, you can use Liquid's include tag.

你只需要在项目的DocumentRoot中创建一个名为 _includes / 的文件夹,然后在里面创建一个HTML文件,例如mycomponent.html并在帖子中用以下内容调用它:

You just have to create a folder with the name _includes/ in the DocumentRoot of your project, then, create an HTML file inside, for example "mycomponent.html" and call it in your post with something like this:

{% include mycomponent.html %}

此文件可以包含您想要的任何HTML / CSS / JS。

This file can have any HTML/CSS/JS you want.

注意你如何仅包含HTML文件;外部CSS / JS可以包含在您正在使用的布局中。

Notice how you include just your HTML file; the external CSS/JS can be included in the layout that you're using.

这篇关于将HTML插入Jekyll帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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