文章数量越多,search.xml内容越多,加载超级慢,该如何解决?
In new version , we can user contain search server.This way not use search.xml。
https://neveryu.github.io/guestbook/
已经对 hexo 无爱.....https://mritd.me
@mritd 你这个也挺好的,请问是怎么制作的?
@hzlpy 用的 jekyll,直接找个主题 就行,ruby写的,Github 目前用的就是这个;感觉 Hexo 不太友好,遇到很多次 都是环境没法复现,比如在这个版本能用,从别的电脑上用新版本重建一个就会出现各种莫名奇怪的错误,而且社区感觉 也并不是太活跃。。。。可能是后台狗 对 js 和 node 不熟悉的原因吧。。。反正总是毛病不断,全站 https 也会有问题,只好放弃了
不想再去折腾jekyll或者其他什么的了,就退而求其次,修改下插件吧。修改hexoblog/node_modules/hexo-generator-search的search.ejs文件,将其中的post.content和pages.content改成post.title和pages.title。然后原先由50篇文章生成的search.xml从800+kb瞬间变成10+kb,至少短期内应该没问题了。
<?xml version="1.0" encoding="utf-8"?>
<search>
<% var url = config.url + config.root %>
<% if(posts){ %>
<% posts.each(function(post){ %>
<entry>
<title><%-: post.title | cdata %></title>
<url><%- encodeURI(post.permalink) %></url>
<content type="html"><%-: post.title | cdata %></content>
</entry>
<% }) %>
<% } %>
<% if(pages){ %>
<% pages.each(function(page){ %>
<entry>
<title><%-: page.title | cdata %></title>
<url><%- encodeURI(page.permalink) %></url>
<content type="html"><%-: page.title | cdata %></content>
</entry>
<% }) %>
<% } %>
</search>