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

Stork search URL is not going to correct place #307

Open
paulocoutinhox opened this issue Aug 3, 2022 · 12 comments
Open

Stork search URL is not going to correct place #307

paulocoutinhox opened this issue Aug 3, 2022 · 12 comments
Labels

Comments

@paulocoutinhox
Copy link

paulocoutinhox commented Aug 3, 2022

Hi,

When enable search, the stork url is not going to correct place when im inside article:
image

Example on screenshot above:
http://localhost:8000/2022/06/28/2022/06/28/apocalipse-de-jesus-cristo-fase-3-o-trono-e-os-seres-viventes.html

duplicated: 2022/06/28/2022/06/28

If im on home, it is working.

Thanks.

@alexandrevicenzi
Copy link
Owner

I'm not able to reproduce this issue, the search takes me to the correct place every time.

@lioman
Copy link
Contributor

lioman commented Sep 5, 2022

I had some similar issue, basically it should work on / but on no other page. If this is your issue:

  1. install pelican search from my branch: https://github.com/lioman/search (A PR is open long ago but not reviewed yet)
  2. Set the input options like this:
SEARCH_INPUT_OPTIONS = f"""url_prefix = "{SITEURL}"
"""

I will adapt the documentation, once PR is merged

@alexandrevicenzi
Copy link
Owner

@lioman I accepted your PRs.

@radoeka
Copy link
Contributor

radoeka commented Mar 26, 2023

As this issue is still open, and I've a question related to stork search, I'll ask it here. Let me know if my question should be administrated in separate issue, please.

Why is this issue still open, the code has been integrated? Is it open to include the documentation? But before you close the issue (if it is to be closed), have a look at my question below, please.

First an observation: The search field is rather big, compared to the other text in the navigation bar one could say, it is huge. Of course it is now the same width as the search results window, but when there are no search results the field attracts the user's attention. It is possible to make the width 80% ( I did so in my own version, and I like the result ).

++ stork.css   2023-03-26 19:37:22.747923623 +0200
@@ -13,7 +13,7 @@
 }
 
 .stork .stork-input {
-  width: 100%;
+  width: 80%;
   padding: 0.4em 0.8em;
   border: none;
   font-family: inherit;

However, my main issue at the moment is that the search results do not point to the correct page. I have a SITEURL including a directory, like so: https://<fqdn>/blog. The search results however, are pointing to https://<fqdn> the folder /blog is left out :(

I set the SEARCH_INPUT_OPTIONS variable to SITEURL: SEARCH_INPUT_OPTIONS = SITEURL

And according to the print out, it is set to the SITEURL:

pelican
...
SEARCH_INPUT_OPTIONS = https://<fqdn>/blog

But is has no effect (at all). Is there anyway to get this working correctly on my site?

Is this a bug, or I'm doing something wrong?

I'm using Flex from git main.

@radoeka
Copy link
Contributor

radoeka commented Mar 26, 2023

Small update:
I changed the SEARCH_INPUT_OPTIONS defination to:

SEARCH_INPUT_OPTIONS = f"""url_prefix = "{SITEURL}"
"""

De output is now:

pelican
...
SEARCH_INPUT_OPTIONS = url_prefix = "https://<fqdn>/blog"

However, the search results still point to https://<fqdn>.

@radoeka
Copy link
Contributor

radoeka commented Mar 26, 2023

Got it working with the patch from lioman applied.

--- plugins/search/search.py-backup     2023-03-26 20:30:19.354948046 +0200
+++ plugins/search/search.py    2023-03-26 20:30:54.546095996 +0200
@@ -30,6 +30,7 @@
         self.tpages = settings.get("TEMPLATE_PAGES")
         self.search_mode = settings.get("SEARCH_MODE", "output")
         self.html_selector = settings.get("SEARCH_HTML_SELECTOR", "main")
+        self.input_options = settings.get("SEARCH_INPUT_OPTIONS", "")
 
     def build_search_index(self, search_settings_path):
         if not which("stork"):
@@ -101,6 +102,7 @@
                 [input]
                 base_directory = "{base_dir}"
                 html_selector = "{self.html_selector}"
+                {self.input_options}
                 {input_files}
             """
         )

@lioman
Copy link
Contributor

lioman commented Mar 31, 2023

This is still open, because my PR is still not merged. It seems that the maintainer just can't find time to review it. Will update this issue, once it is done

@alexandrevicenzi
Copy link
Owner

@lioman I did merge your last PR.

I'm working on Flex v3, which refactors this theme and fixes a few open issues, it will be available later this year.

@alexandrevicenzi
Copy link
Owner

@radoeka the style of the input and result query is provided by stork, you can customize it with custom CSS from pelican settings.

I created a better styling for v3, once v3 is out, stork should have a look similar to everything else in Flex.

@lioman
Copy link
Contributor

lioman commented Apr 12, 2023

@lioman I did merge your last PR.

I'm working on Flex v3, which refactors this theme and fixes a few open issues, it will be available later this year.

I didn't mean you, but the maintainer of the search plugin. Sorry if this was not clear enough.

@lioman
Copy link
Contributor

lioman commented Apr 12, 2023

@alexandrevicenzi @paulocoutinhox pelican-search is released with version 1.1.0 with all my changes. I had to rework large bits of my branch, and the settings mentioned above are not valid anymore.

You need to configure it like this:

STORK_INPUT_OPTIONS = {"url_prefix": SITEURL}

I adapted the wiki and added a site on how to configure it.

@radoeka
Copy link
Contributor

radoeka commented Aug 19, 2023

@lioman: I tried to upgrade from 1.0.2 to 1.1.0, but pelican exits with a CRITICAL. The critical error is:

CRITICAL UnicodeEncodeError: 'latin-1' codec can't encode character '\u2018' in position 1240: ordinal not in __init__.py:566

The error is rather cryptic.

Do you perhaps know what causes this? I've to admit, that I've the deprecation warnings for SEARCH_HTML_SELECTOR and OUTPUT_MODE. Are they maybe the reason for the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants