Code Monkey home page Code Monkey logo

Comments (12)

wzpan avatar wzpan commented on August 19, 2024

Please give me your configurations on the plugin.

from hexo-generator-search.

nodingneu avatar nodingneu commented on August 19, 2024
# 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.

nodingneu avatar nodingneu commented on August 19, 2024

Every other plugin I have seems to work and handle urls correctly.

from hexo-generator-search.

wzpan avatar wzpan commented on August 19, 2024

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.

nodingneu avatar nodingneu commented on August 19, 2024

I haven't set anything like that in my main _config.yml

from hexo-generator-search.

wzpan avatar wzpan commented on August 19, 2024

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.

nodingneu avatar nodingneu commented on August 19, 2024

I am using hexo-theme-material for my theme, maybe it isn't handling it correctly

from hexo-generator-search.

wzpan avatar wzpan commented on August 19, 2024

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.

pidupuis avatar pidupuis commented on August 19, 2024

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.

nodingneu avatar nodingneu commented on August 19, 2024

@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.

wzpan avatar wzpan commented on August 19, 2024

@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.

fomeiherz avatar fomeiherz commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.