Glass
4.0

Author and Editor Documentation

  • Tutorial for Site Authors
  • Plain Text editor
  • Image editor
  • Content Block (WYSIWYG) editor
  • Page List (or “Loop”) Editor
  • Create a new page
  • Add a blog post, article or event
  • Edit site navigation
  • View Contact form submissions

Templates and Data

  • Templates
  • Pages
  • Setting parent page metadata
  • Building and using site menus and navigation
  • Content Chunks
  • Select, Mutli-Select and Tags
  • Forms
  • Search
  • Imgix Integration
  • User Authentication Pages

API, CLI and Advanced Data

  • Glass Command Line & Python Client
  • API
  • Data Store
  • Webhooks
  • Analytics & Events
  • Logs & Errors
  • Cloudflare Integration

Further Help

  • Further Help
Glass
  • Docs »
  • Search
  • View page source

SearchΒΆ

Although many small sites won’t need it, every page on Glass is searchable.

To use search:

  • Make a page with the path search
  • In your template for that page, create a form with one input with name=”q”
  • Iterate over the search hits in your template

Here is a very minimal example:

{% block content %}
<form method="get" action="/search">
<input type="search" name="q" value="{{ request.GET.q }}"><input type="submit" />
</form>

{% for result in results.hits.hits %}
 <h1><a href=/{{ result.path }}?q={{ request.GET.q }}>{{ result.obj.content.title }}</a></h1>
 {% for h in  result.highlight.searchable_text %}
    {{ h|striptags }}
    {% if not forloop.last %}...{% endif %}
 {% endfor %}
 <hr/>
{% endfor %}
{% endblock %}

Search is backed by Elasticsearch and complex searching is available. If you need this please contact Issac for info.

Next Previous

© Copyright 2008-2017, Servee, LLC.

Built with Sphinx using a theme provided by Read the Docs.