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

Improve search file #418

Merged
merged 6 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add excluded for page to be hidden
  • Loading branch information
sylhare committed Dec 16, 2023
commit 2bf2fb57f811c05baf94ddd6205bacac3f49fc70
20 changes: 11 additions & 9 deletions _includes/default/search_input.liquid
Copy link

@EverettYou EverettYou Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend reverting this commit. This makes all the hidden pages not searchable. But they are just hidden from the navigation bar, not meant to be hidden from the search. Or maybe introduce another page property like searchable to indicate if a page should appear in the search.

Copy link
Owner Author

@sylhare sylhare Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed that was the intent, hidden would mean both from search and navigation bar. Let me think for a solution to have a page hidden from the navigation bar but shown in the search 🤔 (I'd rather have a property to hide it from the search result then)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EverettYou I added an excluded option, instead of using hide. Should be better 👍

Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
[
{% for post in site.posts %}
{
"title" : "{{ post.title | strip_newlines | escape }}",
"category" : "{{ post.category }}",
"tags" : "{{ post.tags | join: ', ' | prepend: " " }}",
"url" : "{{ post.url | relative_url }}",
"date" : "{{ post.date | date: "%B %-d, %Y" }}",
"excerpt" : {{ post.content | strip_html | strip_newlines | strip | escape | truncate: '250' | escape | jsonify }},
"content" : {{ post.content | strip_html | strip_newlines | strip | escape | jsonify }}
{% unless post.excluded %}
"title" : "{{ post.title | strip_newlines | escape }}",
"category" : "{{ post.category }}",
"tags" : "{{ post.tags | join: ', ' | prepend: " " }}",
"url" : "{{ post.url | relative_url }}",
"date" : "{{ post.date | date: "%B %-d, %Y" }}",
"excerpt" : {{ post.content | strip_html | strip_newlines | strip | escape | truncate: '250' | escape | jsonify }},
"content" : {{ post.content | strip_html | strip_newlines | strip | escape | jsonify }}
{% endunless %}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
{% if site.pages.size > 0 %},{% endif %}
{% for page in site.pages %}
{
{% unless page.hide or page.title == nil %}
{% unless page.excluded or page.title == nil %}
"title" : "{{ page.title | strip_newlines | escape }}",
"category" : "{{ page.category }}",
"tags" : "{{ page.tags | join: ', ' | prepend: " " }}",
Expand All @@ -27,7 +29,7 @@
{% if site.portfolio.size > 0 %},{% endif %}
{% for page in site.portfolio %}
{
{% if page.title != nil %}
{% if page.excluded or page.title != nil %}
"title" : "{{ page.title | strip_newlines | escape }}",
"category" : "{{ page.category }}",
"tags" : "{{ page.tags | join: ', ' | prepend: " " }}",
Expand Down
1 change: 1 addition & 0 deletions pages/404.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
title: "404 Page not found"
permalink: /404.html
hide: true
excluded: true
---

Sorry, the requested page wasn't found on the server.
1 change: 1 addition & 0 deletions pages/categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ layout: categories
title: Categories
permalink: /categories/
hide: true
excluded: true
---
3 changes: 2 additions & 1 deletion pages/gallery.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ title: Gallery
subtitle: From the pexels folder
permalink: /gallery/
gallery_path: "assets/img/pexels"
excluded: true
position: 3
tags: [Page]
---

This is a photo gallery made from the static files in the `assets/img/pexels` folder.
I wanted to create automatically a simple gallery from a folder without having to create a markdown page as you would for the portfolio.
I wanted to automatically create a simple gallery from a folder without having to create a markdown page as you would for the portfolio.


{% include gallery.html gallery_path=page.gallery_path %}
1 change: 1 addition & 0 deletions pages/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ permalink: /search/
subtitle: "What are you looking for?"
feature-img: "assets/img/pexels/search-map.jpeg"
icon: "fa-search"
excluded: true
position: 5
---