jekyll-lunr-js-search icon indicating copy to clipboard operation
jekyll-lunr-js-search copied to clipboard

baseurl not honored in Mustache url variable

Open jgabrielygalan opened this issue 10 years ago • 5 comments

When setting a baseurl in _config.yml, the links that the Mustache template produces don't contain the baseurl prefix, and so fail. I think the url variable should contain the full url to the post or page, otherwise one would need to hardcode it in the Mustache template. I'm not sure if I'm missing something.

jgabrielygalan avatar Oct 07 '14 17:10 jgabrielygalan

@jgabrielygalan with https://github.com/slashdotdash/jekyll-lunr-js-search/pull/42 base_url comes with the entry so you can do a {{baseurl}} on your mustache template. cheers!

rodrigopavezi avatar Oct 13 '14 15:10 rodrigopavezi

Thanks for your answer, I got it working. That looks like a workaround, though, cause if you setup a baseurl you'll want it in the href, and it would seem nicer to use a single mustache variable, instead of always having to have:

{{baseurl}}{{url}}

Anyway, I'll write the template like that, cause it works.

Thanks.

jgabrielygalan avatar Oct 13 '14 15:10 jgabrielygalan

Yeap, I thought about that. But there are cases where you don't need the baseurl. In my case was the integration with angularJS where baseurl would mess up with the routing.

Cheers!

rodrigopavezi avatar Oct 13 '14 18:10 rodrigopavezi

So, there are two use cases: one in which you always want the baseurl cause you need regular links, and one special one where the links need not have the baseurl for a specific case. Would you be opposed to having two mustache variables, one for each use case? Something like full_url and relative_url or such? I can provide the patch if needed, implementation is quite simple.

jgabrielygalan avatar Oct 14 '14 13:10 jgabrielygalan

I cannot see this anywhere in my installation (used gem to install). How can I add this?

dszabo avatar Mar 18 '15 17:03 dszabo