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

fix: bug in search that was indexing non-content pages #74

Merged
merged 3 commits into from
Dec 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
source "https://rubygems.org"

gem "jekyll", "~> 3.8.3"
gem "rouge"
gem "jekyll-last-modified-at"
gem "jekyll-github-metadata"
gem "jemoji"
source 'https://rubygems.org'

require 'json'
require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read)

gem 'github-pages', versions['github-pages']
gem "jekyll", "~> 3.8.5"
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
gem "jekyll-feed", "~> 0.11"
gem 'github-pages', "202"
gem "jekyll-last-modified-at"
gem "jekyll-github-metadata"
gem "jemoji"
end

gem 'wdm', '>= 0.1.0' if Gem.win_platform?
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ domain: developers.rsk.co

highlighter: rouge

exclude:
- .jekyll-cache

plugins:
- jekyll-last-modified-at
- jekyll-feed
Expand Down
15 changes: 10 additions & 5 deletions search/search.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
---
skip_search: true
---
{% assign pages = site.pages | where_exp: "page", "page.skip_search != true" %}
{% assign pages = site.pages | where_exp: "page", "page.skip_search != true" | where_exp: "page", "page.layout != 'redirect'" %}
{% assign content_sections = "quick-start|the-stack|rsk|rif|develop|contribute" | split: "|" %}
[
{% for page in pages %}
{% for page in pages %} {% assign page_section = page.url | split: "/" %}
{
"title" : "{{ page.title | strip_html | escape }}",
"url" : "{{ site.baseurl }}{{ page.url }}",
"title" : "{{ page.title | strip_html | escape }}",
"category" : "{{ page.categories | join: ', '}}",
"tags" : "{{ page.tags | join: ', ' }}",
"date" : "{{ page.date }}",
{% if content_sections contains page_section[1] %}
{% if page.description %}
"desc" : "{{ page.description | strip_html | escape | strip_newlines | truncatewords: 200, "…" }}"
"desc" : "{{ page.description | strip_html | escape | strip_newlines | truncatewords: 200, "…" }}"
{% else %}
"desc" : "{{ page.content | truncatewords: 200, "…" | markdownify | strip_html | normalize_whitespace | strip_newlines | escape }}"
{% endif %}
{% else %}
"desc" : "{{ page.content | strip_html | escape | strip_newlines | truncatewords: 200, "…" }}"
"desc" : ""
{% endif %}
} {% unless forloop.last %},{% endunless %}
{% endfor %}
Expand Down