Flex icon indicating copy to clipboard operation
Flex copied to clipboard

Stork search URL is not going to correct place

Open paulocoutinhox opened this issue 2 years ago • 12 comments

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.

paulocoutinhox avatar Aug 03 '22 06:08 paulocoutinhox

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

alexandrevicenzi avatar Aug 31 '22 18:08 alexandrevicenzi

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

lioman avatar Sep 05 '22 10:09 lioman

@lioman I accepted your PRs.

alexandrevicenzi avatar Dec 01 '22 11:12 alexandrevicenzi

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 avatar Mar 26 '23 18:03 radoeka

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 avatar Mar 26 '23 18:03 radoeka

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}
             """
         )

radoeka avatar Mar 26 '23 18:03 radoeka

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

lioman avatar Mar 31 '23 17:03 lioman

@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 avatar Mar 31 '23 19:03 alexandrevicenzi

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

alexandrevicenzi avatar Mar 31 '23 19:03 alexandrevicenzi

@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 avatar Apr 12 '23 13:04 lioman

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

lioman avatar Apr 12 '23 16:04 lioman

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

radoeka avatar Aug 19 '23 09:08 radoeka