Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with local search when site_url is not at the root #53

Closed
wants to merge 1 commit into from
Closed

Conversation

pwm1234
Copy link

@pwm1234 pwm1234 commented Sep 5, 2014

When the site url is not at the root, the localsearch plugin init.py needed to be modified slightly to include the folder when using the post permalink. In addition, I added some corresponding comments to the conf.py.sample.

@@ -81,7 +83,7 @@ def save_data():
data["title"] = post.title(lang)
data["text"] = text
data["tags"] = ",".join(post.tags)
data["loc"] = post.permalink(lang)
data["loc"] = urlparse(post.base_url).path.rstrip('/') + post.permalink(lang)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this produces an URL like http://example.com/nikolasite/posts/welcome-to-nikola.html, then you should do:

                    data["loc"] = post.permalink(lang=lang, absolute=True)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think of that way first, but it makes the content.json file contain absolute paths to the SITE_URL. This way the content.json file may be used on any site that has the same folder path structure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s not do that. This is a 1% use case, we’re better off generating files that work for this Nikola site only and fuck everyone else.

Kwpolska added a commit to getnikola/nikola that referenced this pull request Sep 6, 2014
via getnikola/plugins#53

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
@pwm1234 pwm1234 closed this Mar 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants