Skip to content

Commit

Permalink
escpe backslash in search results; fixes #1279
Browse files Browse the repository at this point in the history
  • Loading branch information
daattali committed Jul 10, 2024
1 parent a5b9bed commit ac7d602
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Added explicit support for favicons, you only need to add a `favicon.ico` file to the root directory
- The footer of a page always sticks to the bottom, even on short pages (#576)
- Added `author` YAML parameter to allow specifying the author(s) of a post (#1220)
- Fixed bug where search results broke if a post title had a backslash (#1279)
- Fixed bug where hovering over search results showed the text "{desc}" (#1156)
- Added social network links for GitLab, Bluesky, Whatsapp, Untappd (#1168, #1218, #1299, #1307)
- Use CSS variables (#661)
Expand Down
4 changes: 2 additions & 2 deletions _includes/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
var searchjson = '[ \
{% for post in site.posts %} \
{ \
"title" : "{% if post.title != "" %}{{ post.title | strip_html | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", \
"desc" : "{% if post.title != "" %}{{ post.title | strip_html | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", \
"title" : "{% if post.title != "" %}{{ post.title | strip_html | escape | replace: "\", "\\\" }}{% else %}{{ post.excerpt | strip_html | escape | strip | replace: "\", "\\\" }}{%endif%}", \
"desc" : "{% if post.title != "" %}{{ post.title | strip_html | escape | replace: "\", "\\\" }}{% else %}{{ post.excerpt | strip_html | escape | strip | replace: "\", "\\\" }}{%endif%}", \
"category" : "{{ post.tags | join: \', \' }}", \
"url" : "{{ site.baseurl }}{{ post.url | escape }}", \
"date" : "{{ post.date | date: "%B %e, %Y" | default: "January 1, 1970" }}" \
Expand Down

0 comments on commit ac7d602

Please sign in to comment.