Jieiku / abridge

Fast & Lightweight Zola Theme
https://abridge.pages.dev/
MIT License
147 stars 41 forks source link

Tinysearch data contains extra comma #93

Closed ms-ati closed 1 year ago

ms-ati commented 1 year ago

Hi! Tinysearch mode appears to create a public/data_tinysearch/index.html which starts with an illegal character sequence due to a comma:

[,{

It seems we need to delete the , at character 2 for it to work?

Jieiku commented 1 year ago

Thanks for the report, I will investigate this (probably tomorrow, busy the rest of today)

When I initially implemented tinysearch I was not seeing any errors: https://jieiku.github.io/abridge-tinysearch/

Jieiku commented 1 year ago

I am not able to reproduce this, here is what I did:

git clone https://github.com/Jieiku/abridge
cd abridge
sed -i 's/^search_library =.*/search_library = "tinysearch"/' config.toml
zola build
tinysearch --optimize --path static public/data_tinysearch/index.html
zola serve

If you have a repository that this happens with that I can clone, then I can try to figure out the cause.

ms-ati commented 1 year ago

If you take the demo, and then:

Does that reproduce it?

On Tue, Sep 20, 2022 at 7:30 AM Jake G @.***> wrote:

I am not able to reproduce this:

git clone https://github.com/Jieiku/abridgecd abridge sed -i 's/^search_library =.*/search_library = "tinysearch"/' config.toml zola build tinysearch --optimize --path static public/data_tinysearch/index.html zola serve

If you have a repository that this happens with that I can clone, then I can try to figure out the cause.

— Reply to this email directly, view it on GitHub https://github.com/Jieiku/abridge/issues/93#issuecomment-1252218549, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQX7G2ZBA5BDUXO6QSHQTV7GN4PANCNFSM6AAAAAAQQNQJP4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Marc Siegel Technology Specialist American Technology Innovations

Email: @.*** Phone: 1 (617) 399-8145 Cell: 1 (617) 223-1220 Fax: 1 (617) 334-7975

Jieiku commented 1 year ago

I was able to reproduce by marking them all as draft.

Not yet sure why this impacts it but will take a look at it soon.

Jieiku commented 1 year ago

I was able to figure out the exact reason for this. Zola creates a section for every directory that contains a _index.md file

For every directory that has this _index.md file you have to have atleast one item that is NOT marked as draft.

So for instance if you mark content/pages/privacy.md and content/overview-abridge.md as draft = false then tinysearch will build the index without a problem. The logic for this is abridge/templates/macros/create_tinysearch_json.html

2022-09-20_13-44-10

I will see if I can find a fix for this, but this post should clear things up for what you must do in the meantime to generate the index.

Jieiku commented 1 year ago

This is now resolved, I also applied the fix for the Stork index generation, but if you dont have a single page in your site that is not a draft then stork wont actually build the index because it would be empty, tinysearch will now build an empty index though and so this issue is now resolved.

Jieiku commented 1 year ago

Also the abridge tinysearch demo has code that is not in the official tinysearch yet, my pull request has not yet been merged: https://github.com/tinysearch/tinysearch/pull/161

So you may notice that my demo of abridge tinysearch has a short description for links that yours does not unless you incorporate the code from my pull request, hopefully it gets merged soon.

ms-ati commented 1 year ago

Oh wow! TYSM. Do you have snipped for how you build the abridge tinysearch demo, do you first check out your PR branch and build that?

Jieiku commented 1 year ago

Oh wow! TYSM. Do you have snipped for how you build the abridge tinysearch demo, do you first check out your PR branch and build that?

yes here is how:

First remove installed tinysearch

which tinysearch
sudo rm -rf /usr/local/bin/tinysearch

Next install version with pull request

git clone -b meta-field https://github.com/Jieiku/tinysearch
cd tinysearch
cargo build --release
sudo cp ./target/release/tinysearch /usr/local/bin/tinysearch
exit

Then build the index:

sed -i 's/^search_library =.*/search_library = "tinysearch"/' config.toml
zola build
tinysearch --optimize --path static public/data_tinysearch/index.html
zola serve

Hopefully my pull request will be merged soon.