[英]Include external html into enduro.js
I have an enduro.js blog based on this tutorial: 我有一个基于本教程的enduro.js博客:
https://www.endurojs.com/blog/how-to-make-a-blog-with-endurojs https://www.endurojs.com/blog/how-to-make-a-blog-with-endurojs
And I want to add navbar and footer as external .html
files available on some URL. 我想添加导航栏和页脚作为某些URL上可用的外部.html
文件。 How can I include some navbar url into following code which is component "header.hbs": 如何在以下代码“header.hbs”中包含一些导航栏网址:
<header>
<div class="inner">
<h1><a href="{{global.base_url}}">{{global.site_name}}</a></h1>
{{#if global.site_description}}
<p>{{global.site_description}}</p>
{{/if}}
</div>
</header>
<nav class="aSiteNav" id="navbarDiv">
<div class="inner">
{{#if global.show_archive_link}}
<a href="/blog/archive/">{{global.archive_link_text}}</a>
{{/if}}
{{#navlinks}}
{{#each this}}
<a href="/blog/pages/{{this.page_slug}}/">{{this.content.navigation_title}}</a>
{{/each}}
{{/navlinks}}
</div>
</nav>
You can try something like this 你可以尝试这样的事情
<header>
<iframe id="inlineFrameExample" src="{{url_of_your_header}}"></iframe>
</header>
I solved it by including jquery: 我通过包含jquery来解决它:
<header>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(function(){
$("#navbar").load("https://mydomain.xyz/navbar.html");
});
</script>
<div class="inner" id="navbar">
</div>
</header>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.