前言
- 環(huán)境
hexo: "3.7.1"
theme: landscape
瀏覽器:谷歌
- 問題
GET https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js net::ERR_TIMED_OUT
- 思路
由于jquery地址只支持http請求旬昭,故需要更換此地址赋秀,才能正常加載钻注。查看index的文件發(fā)現(xiàn)此連接是在文件尾部的片仿,故需要找到生產(chǎn)index文件的模板文件,在里面修改陆淀。下面是我根據(jù)hexo的默認(rèn)模板修改的考余,僅做參考。
實(shí)現(xiàn)方式
在\themes\landscape\layout
目錄下查看layout.ejs文件轧苫,查看index文件的生成具體規(guī)則楚堤,如下:
<%- partial('_partial/head') %>
<body>
<div id="container">
<div id="wrap">
<%- partial('_partial/header', null, {cache: !config.relative_link}) %>
<div class="outer">
<% if (theme.sidebar && theme.sidebar !== 'bottom'){ %>
<%- partial('_partial/sidebar', null, {cache: !config.relative_link}) %>
<% } %>
<section id="main"><%- body %></section>
</div>
<%- partial('_partial/footer', null, {cache: !config.relative_link}) %>
</div>
<%- partial('_partial/mobile-nav', null, {cache: !config.relative_link}) %>
<%- partial('_partial/after-footer') %>
</div>
</body>
</html>
打開themes\landscape\layout\_partial
下的after-footer.ejs文件
將
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js "></script>
修改成
<script src="/js/jquery.min.js"></script>
不可直接修改成http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
,因?yàn)樵趆ttps下面的文件是訪問http需要解決跨域問題。
以上,便可修改hexo的全局jquery身冬。