Add tipue search integration (#193)

* Add tipue search integration
This commit is contained in:
Jack McKew 2020-02-08 04:06:17 +11:00 committed by GitHub
parent 6c2f3a21cc
commit fbe7d17fb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 227 additions and 1 deletions

View file

@ -28,6 +28,14 @@
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stylesheet/style.min.css">
{% endif %}
{% if USE_TIPUE_SEARCH %}
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/jquery.min.js"></script>
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.js"></script>
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.js"></script>
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch_set.min.js"></script>
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.css" />
{% endif %}
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE|default('github') }}.min.css">
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/fontawesome.css">
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/brands.css">
@ -103,7 +111,11 @@
<h1><a href="{{ SITEURL }}">{{ SITETITLE }}</a></h1>
{% if SITESUBTITLE %}<p>{{ SITESUBTITLE }}</p>{% endif %}
{% if USE_TIPUE_SEARCH %}
<form class="navbar-search" action="/search.html" role="search">
<input type="text" name="q" id="tipue_search_input" placeholder="Search..">
</form>
{% endif %}
{% if pages or LINKS %}
<nav>
<ul class="list">
@ -218,5 +230,13 @@
{% if GITHUB_CORNER_URL %}
{% include 'partial/github.html' %}
{% endif %}
{% if USE_TIPUE_SEARCH %}
<script>
$(document).ready(function() {
$('#tipue_search_input').tipuesearch();
});
</script>
{% endif %}
</body>
</html>

19
templates/search.html Normal file
View file

@ -0,0 +1,19 @@
{% if USE_TIPUE_SEARCH %} {% extends 'base.html' %} {% block title %} {{ _('Search') }} - {{ SITENAME|striptags }} {% endblock title %} {% block content %}
<script>
$(document).ready(function() {
$('#tipue_search_input').tipuesearch({
'show': 10,
'mode': 'json',
'contentLocation': '{{ SITEURL }}/tipuesearch_content.js'
});
});
</script>
<article class="single">
<header>
<h1 id="categories">{{ _('Search Results') }}</h1>
</header>
<div id="tipue_search_content"></div>
</article>
{% endblock content %} {% endif %}