Comments (12)
Please give me your configurations on the plugin.
from hexo-generator-search.
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://theonlygusti.github.io/blog
root: /blog/
permalink: :year/:month/:day/:title/
permalink_defaults:
from hexo-generator-search.
Every other plugin I have seems to work and handle urls correctly.
from hexo-generator-search.
What you give me is the setting of your site's root. Whereas I want the setting of you search plugin, for example:
search:
path: search.xml
field: all
I've wrote two themes for Hexo. One is hexo-theme-freemind and the other is hexo-theme-wixo. Both have used hexo-generator-search for local searching and are put in a subdirectory like your site does. And the plugin works like a charm on both sites. Maybe you can take a look at the settings of these two examples and try to figure out what is the underlying problem.
from hexo-generator-search.
I haven't set anything like that in my main _config.yml
from hexo-generator-search.
If you don't need that, you must have hard code it some where in the layout templates. Could you write down it for me? For example, here's the code I wrote for hexo-theme-freemind to load search.xml:
<% if (config.search) { %>
<script type="text/javascript">
var search_path = "<%= config.search.path %>";
if (search_path.length == 0) {
search_path = "search.xml";
}
var path = "<%= config.root %>" + search_path;
searchFunc(path, 'local-search-input', 'local-search-result');
</script>
<% } %>
See? You should pass an available path
param that correctly points out the path to access your search.xml .
from hexo-generator-search.
I am using hexo-theme-material for my theme, maybe it isn't handling it correctly
from hexo-generator-search.
If you find difficult to customize your theme to support hexo-generator-search, then I would rather suggest you to use hexo-theme-freemind. The local search engine works out of box there.
I think I should have given you all the necessary info about how to set up the fire of hexo-generator-search. I will close this issue. If you still want more help, you can continue to ask me questions.
from hexo-generator-search.
As you can see in the search.xml
file generated by hexo-generator-search
, the urls are already broken. The theme simply take the url. The problem seems to come from your part...
from hexo-generator-search.
@wzpan Actually, this still seems to be an issue relevant to the hexo-generator-plugin
rather than the theme I'm using.
Your plugin generates the search.xml
file, however this file is already creating the incorrect links, have a look at mine:
<url>http://theonlygusti.github.io/blog/blog/2017/01/21/first-post/</url>
It should be http://theonlygusti.github.io/blog/2017/01/21/first-post/
from hexo-generator-search.
@theonlygusti Then please give me the full code that you put the plugin to work. There must be something wrong with the path you ask the generator to parse the link.
from hexo-generator-search.
Link cannot redirect to correctly.
So I must change file: /themes/xxx/layout/partials/scripts.ejs
str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
change to:
str += "<li><a href='/" + data_url + "' class='search-result-title'>" + data_title + "</a>";
from hexo-generator-search.
Related Issues (20)
- 新年第一个问题...关于搜索结果 HOT 6
- View all search results
- 怎么支持标题也高亮关键词?
- 搜索加载失败
- 有没有办法让"hexo-generator-search"的"content"存原始的md文档内容 HOT 1
- Wrong blog post url in search.xml HOT 3
- Option to include excerpt
- 点击搜索结果 404 问题 HOT 8
- 求助。search出来的内容点击没有跳转 HOT 1
- 本地和线上的搜索界面不同 HOT 2
- Search (xml) fails to include full URI
- Search error, redirect to 0.0.7.229 HOT 3
- Request for filter features.
- The search bar position appears at the bottom of the page HOT 2
- 报错报错报错 HOT 1
- 请问 HOT 1
- 能否在搜索功能中增加关键词 HOT 3
- Can I search titile only when enable content index? HOT 3
- Support for Static Pages HOT 1
- redirect error search/undefined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-generator-search.