Skip to content

Commit

Permalink
Added logic to remove the dum my {} code and any empty "tags" listi…
Browse files Browse the repository at this point in the history
…ngs.
  • Loading branch information
mig281 committed Nov 15, 2023
1 parent 5b90619 commit 5c2f610
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,32 @@ search: exclude
---

[
{%- assign is_first = true -%}
{%- for page in site.html_pages -%}
{%- unless page.search == "exclude" or page.keywords == "" or page.keywords == nil -%}
{%- unless page.search == "exclude" or page.keywords == "" or page.keywords == nil -%}
{% case page.sidebar %}
{% when "azure_guide_sidebar" %}
{% assign prefix = "Azure: " %}
{% when "administrator_guide_sidebar" %}
{% assign prefix = "On-Prem: " %}
{% else %}
{% assign prefix = "" %}
{% endcase %}

{%- if is_first -%}
{%- assign is_first = false -%}
{%- else -%}
,
{%- endif -%}
{
"title": "{% if page.url contains 'azure-administrator-guide' %}Azure: {% elsif page.url contains 'administrator-guide' %}On-Prem: {% endif %}{{ page.title | escape }}",
"tags": "{{ page.tags }}",
"keywords": "{{page.keywords}}",
"url": "{{ page.url }}",
"summary": "{{page.summary | strip }}"
},
{%- endunless -%}
"title": "{{ prefix }}{{ page.title | escape }}"
{%- if page.tags != empty and page.tags != null -%},
"tags": "{{ page.tags }}"
{%- endif -%},
"keywords": "{{ page.keywords }}",
"url": "{{ page.url }}",
"summary": "{{ page.summary | strip }}"
}
{%- endunless -%}
{%- endfor -%}
{}
]

0 comments on commit 5c2f610

Please sign in to comment.