Skip to content
Permalink
Browse files

feat(clean url): support clean URL for search page

  • Loading branch information...
talha131 committed Aug 10, 2019
1 parent a837c28 commit 088791e158287967eb4cd5d2f9ab247df530cb7f
@@ -51,3 +51,11 @@ For pages, set
PAGE_URL = "{slug}"
PAGE_SAVE_AS = "{slug}.html"
```

## Search

For search page, set

```python
SEARCH_URL = "search"
```
@@ -58,6 +58,7 @@
TAGS_URL = "tags"
CATEGORIES_URL = "categories"
ARCHIVES_URL = "archives"
SEARCH_URL = "search"

# Feeds
AUTHOR_FEED_ATOM = None
@@ -20,7 +20,8 @@ <h1>That page doesn't exist!</h1>
<p>Sorry, but the page you are looking for cannot be found. It seems that the page you were trying to reach doesn't exist, or may be it has just moved, or it no longer exists.</p>
<p>The best thing to do is to use the search form or start again from the <a href="{{ SITEURL }}">home page</a>.</p>
<div class="input-append">
<form action="{{ SITEURL }}/search.html" onsubmit="return validateForm(this.elements['q'].value)">
{% from '_includes/_defaults.html' import SEARCH_URL with context %}
<form action="{{ SITEURL }}/{{ SEARCH_URL }}" onsubmit="return validateForm(this.elements['q'].value)">
<input type="text" class="span12" placeholder="Search" name="q" id="tipue_search_input_404">
<button class="btn" type="submit">Search</button>
</form>
@@ -194,3 +194,9 @@
{% else %}
{% set ARCHIVES_URL = ARCHIVES_URL %}
{% endif %}

{%if not SEARCH_URL %}
{% set SEARCH_URL = 'search.html' %}
{% else %}
{% set SEARCH_URL = SEARCH_URL %}
{% endif %}
@@ -78,11 +78,11 @@
<li {% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">{{ p.title }}</a></li>
{% endfor %}
{% endif %}
{% from '_includes/_defaults.html' import TAGS_URL, CATEGORIES_URL, ARCHIVES_URL with context %}
{% from '_includes/_defaults.html' import TAGS_URL, CATEGORIES_URL, ARCHIVES_URL, SEARCH_URL with context %}
<li {% if page_name == 'categories' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ CATEGORIES_URL }}">Categories</a></li>
<li {% if page_name == 'tags' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ TAGS_URL }}">Tags</a></li>
<li {% if page_name == 'archives' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ ARCHIVES_URL }}">Archives</a></li>
<li><form class="navbar-search" action="{{ SITEURL }}/search.html" onsubmit="return validateForm(this.elements['q'].value);"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li>
<li><form class="navbar-search" action="{{ SITEURL }}/{{ SEARCH_URL }}" onsubmit="return validateForm(this.elements['q'].value);"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li>
</ul>
</div>
</div>
@@ -10,14 +10,14 @@

{% block meta_tags_in_head %}
{{ super() }}
{% from '_includes/_defaults.html' import FEATURED_IMAGE, SEARCH_URL with context %}
<meta property="og:title" content="Search · {{ SITENAME|striptags|e }}"/>
<meta name="twitter:title" content="Search · {{ SITENAME|striptags|e }}">
<meta property="og:url" content="{{ SITEURL }}/search.html" />
<meta property="og:url" content="{{ SITEURL }}/{{ SEARCH_URL }}" />
<meta property="og:description" content="Search results for {{ SITENAME|striptags|e }} blog" />
<meta name="twitter:description" content="Search results for {{ SITENAME|striptags|e }} blog">
<meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
<meta property="og:article:author" content="{{ AUTHOR }}" />
{% from '_includes/_defaults.html' import FEATURED_IMAGE with context %}
{% if FEATURED_IMAGE %}
<meta property="og:image" content="{{FEATURED_IMAGE}}" />
<meta name="twitter:image" content="{{FEATURED_IMAGE}}" >

0 comments on commit 088791e

Please sign in to comment.
You can’t perform that action at this time.