commit c8fb8ed9a15c99378685e39e8ac8492ddf504355
parent 3d1eb23a10487cbaf838f37c32ac9f83a6113ae2
Author: Natalie Pendragon <natpen@natpen.net>
Date: Tue, 30 Jun 2020 08:28:39 -0400
[serve] Improve verbose mode
Diffstat:
3 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/serve/templates/about.gmi b/serve/templates/about.gmi
@@ -45,13 +45,13 @@ For further inspiration on how to use these filters, you can visit both GUS' lis
### Verbose Mode
-To allow greater insight into both how pages are ranking against each other, as well as when GUS crawled their content, you can enable verbose mode on any search results page. This will show the numerical score of each search result for the given query, as well as the exact time that page was crawled.
+To allow greater insight into both how pages are ranking against each other, as well as when GUS crawled their content, you can enable verbose mode on any search results page. This will show the numerical score of each search result for the given query, the exact time that page was crawled, as well as its specified charset.
-To enable verbose mode for a given search result page, you should add a new "v" path component to the URL preceding the "search" component. Below is an example:
+There is a button at the top of each search results page to toggle verbose mode on or off, but you can also specify verbose mode manually in your URLs by utilizing the below pattern. Simply add a new "v" path component to the URL preceding the "search" path component. Below is an example:
-=> gemini://gus.guru/search?test
-=> gemini://gus.guru/v/search?test
+=> gemini://gus.guru/search?gemini
+=> gemini://gus.guru/v/search?gemini
-Note that verbose mode is not sticky, so navigating away from a verbose search result page will return you to non-verbose mode.
+Note that verbose mode is sticky, and will persist between pages of results results, so you will need to manually toggle verbose mode off when you are finished with it.
{% include 'fragments/footer.gmi' %}
diff --git a/serve/templates/fragments/pager.gmi b/serve/templates/fragments/pager.gmi
@@ -1,10 +1,11 @@
+{% set search_path = "/v/search" if verbose else "/search" %}
Page {{current_page}} of {{num_pages}} ({{num_results}} results)
{% if current_page > 2 %}
-=> /search?{{ quoted_query }} First Page
+=> {{ search_path }}?{{ quoted_query }} First Page
{% endif %}
{% if current_page > 1 %}
-=> /search/{{ current_page - 1 }}?{{ quoted_query }} Previous Page
+=> {{ search_path }}/{{ current_page - 1 }}?{{ quoted_query }} Previous Page
{% endif %}
{% if current_page < num_pages %}
-=> /search/{{ current_page + 1}}?{{ quoted_query }} Next Page
+=> {{ search_path }}/{{ current_page + 1}}?{{ quoted_query }} Next Page
{% endif %}
diff --git a/serve/templates/search.gmi b/serve/templates/search.gmi
@@ -1,22 +1,28 @@
{% include 'fragments/header.gmi' %}
-# Search GUS
+{% if verbose %}
+## Search [verbose]
+=> /search/{{ current_page }}?{{ quoted_query }} Exit verbose mode
+{% else %}
+## Search
+=> /v/search/{{ current_page }}?{{ quoted_query }} Enter verbose mode
+{% endif %}
"{{ query }}"
{% for result in results %}
=> {{ result["fetchable_url"] }} {{ result["link_text"] }}
{% if verbose %}
-* Score : {{ "{:.2f}".format(result["score"]) }}
-* Indexed at : {{ "{:%Y-%m-%d %H:%M}".format(result["indexed_at"]) }}
-* Charset : {{ result["charset"] }}
-{% endif %}
{% if result["backlinks"] | length > 1 %}
=> /backlinks?{{ result["url"] | urlencode }} {{ result["backlinks"] | length }} backlinks
{% elif result["backlinks"] | length > 0 %}
=> /backlinks?{{ result["url"] | urlencode }} {{ result["backlinks"] | length }} backlink
{% endif %}
+* Score : {{ "{:.2f}".format(result["score"]) }}
+* Indexed at : {{ "{:%Y-%m-%d %H:%M}".format(result["indexed_at"]) }}
+* Charset : {{ result["charset"] }}
+{% endif %}
{% if result["highlights"] | length > 0 %}
{{ result["highlights"] }}
{% endif %}