[gimp-web/testing: 4/7] Add search page



commit a5857d56ffef82621d8592ee38e45618b0b725ff
Author: Pat David <patdavid gmail com>
Date:   Fri May 27 16:44:08 2016 -0500

    Add search page
    
    This adds the search.md page under document root and
    a template for the search results page.
    
    See the PAGE_PATHS variable in pelicanconf*.py where
    it needs to be included to parse correctly.

 content/search.md                    |    9 +++
 themes/newgimp/templates/search.html |  124 ++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+), 0 deletions(-)
---
diff --git a/content/search.md b/content/search.md
new file mode 100644
index 0000000..efffabf
--- /dev/null
+++ b/content/search.md
@@ -0,0 +1,9 @@
+Title: Search
+Date: 2016-05-27
+Author: Pat David
+url: search.html
+save_as: search.html
+status: hidden
+Template: search
+lang: en
+
diff --git a/themes/newgimp/templates/search.html b/themes/newgimp/templates/search.html
new file mode 100644
index 0000000..dee7ec5
--- /dev/null
+++ b/themes/newgimp/templates/search.html
@@ -0,0 +1,124 @@
+{% extends "base.html" %}
+
+{% block title %}{{ SITENAME }} - {{ page.title|striptags }}{%endblock%}
+
+{% block head %}
+{{ super() }}
+        <link rel='stylesheet' type='text/css' href="/theme/css/page.css" />
+        <link rel='stylesheet' type='text/css' href="/theme/css/pygments-default.css" />
+        
+        <meta itemprop='url' content='{{ SITEURL }}/{{ page.url }}' />
+        <meta itemprop='name' content='{{ SITENAME }} - {{ page.title|striptags }}' />
+        <meta itemprop='image' content='{{ SITEURL }}/images/frontpage/wilber-big.png' />
+
+        <meta property='og:url' content='{{ SITEURL }}/{{ page.url }}' />
+        <meta property='og:title' content='{{ SITENAME }} - {{ page.title|striptags }}' />
+        <meta property='og:image' content='{{ SITEURL }}/images/frontpage/wilber-big.png' />
+
+        {% if page.authors %}
+        {% for author in page.authors %}
+        <meta itemprop='author' content='{{ author }}' />
+        <meta property='og:author' content='{{ author }}' />
+        {% endfor %}
+        {% endif %}
+
+        {% if page.summary %}
+        <meta itemprop='description' content="{{ page.summary|striptags }}" />
+        <meta property='og:description' content="{{ page.summary|striptags }}" />
+        {% else %}
+        <meta itemprop='description' content="{{ page.content|striptags|truncate() }}" />
+        <meta property='og:description' content="{{ page.content|striptags|truncate() }}" />
+        {% endif %}
+
+        {# For Tipue Search #}
+        {# We should probably leverage the cache on google - need to get opinions first
+        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";></script>
+        #}
+        {# For now, host this locally #}
+        <script src="/js/jquery.min.js"></script>
+
+        <link href="theme/css/tipuesearch/tipuesearch.css" rel="stylesheet">
+        <script src="/tipuesearch_content.json"></script>
+        <script src="/js/tipuesearch_set.js"></script>
+        <script src="/js/tipuesearch.min.js"></script>
+
+{% endblock head %}
+
+{% block content %}
+
+    <div class="container title">
+        <div class="row clearfix">
+            <div class="column full">
+                <h1>{{ page.title }}</h1>
+                {% import 'translations.html' as translations with context %}
+                {{ translations.translations_for(page) }}
+            </div>
+        </div>
+    </div>
+
+    <section class='page_content'>
+        <div class='container'>
+            <div class='row clearfix'>
+                <div class='column full'>
+                    <form action="search.html">
+                        <input type="text" name="q" id="tipue_search_input" autocomplete="off" required 
style='width:100%;'>
+                    </form>
+                    <div id="tipue_search_content">
+                    </div>
+                    {{ page.content }}
+                </div>
+            </div>
+        </div>
+    </section>
+
+       {% if page.modified  and PAGES_DEBUG == true %}
+               <p>
+            <small>Created: {{ page.locale_date }}</small>,  
+            <small>Last updated: {{ page.locale_modified }}</small>
+               </p>
+       {% endif %}
+
+
+    {% if PAGES_DEBUG == true %}
+    <div style="border: dotted 1px #ccc; ;" class='page_content'>
+        
+        <div style='font-size: 80%;'>
+            <p>Debug stuff.  Ignore</p>
+            <p>
+                url: {{ page.url }} <br/>
+                slug: {{ page.slug }}<br/>
+                {% if page.parent %}
+                page parent: {{ page.parent }}<br/>
+                page parent url: {{ page.parent.url }} <br/>
+                page parent title: {{ page.parent.title }}
+                {% endif %}
+            </p>
+        
+            <p>page parents</p>
+        <ul>
+            <li>page.parents.length: {{ page.parents|length }}</li>
+            {% for parent in page.parents %}
+            <li>url: {{ parent.url }} - title: {{ parent.title }}<br/>
+                <a href="/{{ parent.url }}">{{ parent.title }}</a></li>
+            {% endfor %}
+        </ul>
+        <p>page children</p>
+        <ul>
+            {% for child in page.children %}
+            <li>url: {{ child.url }} - title: {{ child.title }}<br/>
+                <a href="/{{ child.url }}">{{ child.title }}</a></li>
+            {% endfor %}
+        </ul>
+        </div>
+    </div>
+    {% endif %}
+
+    <script>
+    $(document).ready(function() {
+        $('#tipue_search_input').tipuesearch({
+            'descriptiveWords': 50
+                });
+    });
+    </script>
+
+{% endblock %}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]