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

[bug] config.search.index_format not accessible from templates. #2165

Closed
Jieiku opened this issue Apr 3, 2023 · 3 comments
Closed

[bug] config.search.index_format not accessible from templates. #2165

Jieiku opened this issue Apr 3, 2023 · 3 comments
Labels
done in pr Already done in a PR enhancement

Comments

@Jieiku
Copy link
Contributor

Jieiku commented Apr 3, 2023

Bug Report

I am in the process of refactoring the Abridge theme.
One of the things I am doing is switching over to the new json index format

When using the new json index format, you use a different search.js then you would with the regular js index. (this new version fetches the json file on interaction)

because of this I need to ensure or check that the right configuration is set.

  {%- if config.search.index_format == "elasticlunr_json" %}
  <script defer src="{{ get_url(path='search_json.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='search_json.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script>
  {%- else %}
  <script defer src="{{ get_url(path='search_js.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='search_js.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script>
  {%- endif %}

Environment

Zola version: 0.17.1

Expected Behavior

I need for config.search.index_format to be accessible.

OR maybe build_search_index = true could also be build_search_index = "elasticlunr_json" then there would not even be the need for the additional index_format field.

Current Behavior

Currently you cannot check the value of config.search.index_format from templates

Raymi306 added a commit to Raymi306/zola-fork that referenced this issue Apr 27, 2023
Raymi306 added a commit to Raymi306/zola-fork that referenced this issue Apr 27, 2023
Keats pushed a commit that referenced this issue May 1, 2023
* Add search into the serialized config (#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
@Raymi306
Copy link
Contributor

Raymi306 commented May 3, 2023

This can be closed

@Keats Keats added the done in pr Already done in a PR label May 3, 2023
@Keats
Copy link
Collaborator

Keats commented May 3, 2023

Issues are only closed once the Zola release containing the fix is released

@Raymi306
Copy link
Contributor

Raymi306 commented May 3, 2023

Oh WHOOPS! I commented on several issues, my bad!

peterprototypes pushed a commit to peterprototypes/zola that referenced this issue Sep 12, 2023
…tzola#2196)

* Add search into the serialized config (getzola#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
technimad pushed a commit to technimad/zola that referenced this issue Sep 30, 2023
…tzola#2196)

* Add search into the serialized config (getzola#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
Keats pushed a commit that referenced this issue Dec 18, 2023
* Add search into the serialized config (#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
@Keats Keats closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done in pr Already done in a PR enhancement
Projects
None yet
Development

No branches or pull requests

3 participants