mirror of
https://github.com/thangisme/notes.git
synced 2025-01-03 04:46:40 -05:00
Allow for ampersand in title or URL
Because `page.title` (and `page.url`) is already escaped and page titles served by lunrjs do not need escaping, ampersands need to be unescaped to display properly in search results.
This commit is contained in:
parent
9a4ea76957
commit
60c82cb518
@ -3,10 +3,10 @@
|
||||
{
|
||||
{% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
|
||||
"id": "{{ forloop.index0 }}",
|
||||
"title": "{{ page.title | xml_escape }}",
|
||||
"title": "{{ page.title | replace: '&', '&' }}",
|
||||
"content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}",
|
||||
"url": "{{ page.url | absolute_url | xml_escape }}",
|
||||
"relUrl": "{{ page.url | xml_escape }}"
|
||||
"url": "{{ page.url | absolute_url }}",
|
||||
"relUrl": "{{ page.url }}"
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endif %}{% endfor %}
|
||||
}
|
||||
|
@ -39,10 +39,10 @@ This command creates the `search-data.json` file that Jekyll uses to create your
|
||||
{
|
||||
{% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
|
||||
"id": "{{ forloop.index0 }}",
|
||||
"title": "{{ page.title | xml_escape }}",
|
||||
"title": "{{ page.title | replace: '&', '&' }}",
|
||||
"content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}",
|
||||
"url": "{{ page.url | absolute_url | xml_escape }}",
|
||||
"relUrl": "{{ page.url | xml_escape }}"
|
||||
"url": "{{ page.url | absolute_url }}",
|
||||
"relUrl": "{{ page.url }}"
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endif %}{% endfor %}
|
||||
}{% endraw %}
|
||||
|
@ -14,10 +14,10 @@ namespace :search do
|
||||
{
|
||||
{% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
|
||||
"id": "{{ forloop.index0 }}",
|
||||
"title": "{{ page.title | xml_escape }}",
|
||||
"title": "{{ page.title | replace: '&', '&' }}",
|
||||
"content": "'+content+'",
|
||||
"url": "{{ page.url | absolute_url | xml_escape }}",
|
||||
"relUrl": "{{ page.url | xml_escape }}"
|
||||
"url": "{{ page.url | absolute_url }}",
|
||||
"relUrl": "{{ page.url }}"
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endif %}{% endfor %}
|
||||
}'
|
||||
|
Loading…
Reference in New Issue
Block a user