Skip to content

Commit

Permalink
Add a basic example of a search page
Browse files Browse the repository at this point in the history
  • Loading branch information
kolber committed Aug 28, 2013
1 parent ffe9d29 commit a6f4802
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/cache.inc.php
Expand Up @@ -75,7 +75,7 @@ function create_full_cache($pages = null) {
if ($page['is_folder']) {
$current_page = AssetFactory::get($page['path']);
# Skip for password protected pages
if ($current_page['password_protect'] || $current_page['hide_from_search']) continue;
if (isset($current_page['password_protect']) || isset($current_page['hide_from_search'])) continue;
# Only save search field data
foreach ($current_page as $key => $value) {
if (!in_array($key, $search_fields)) unset($current_page[$key]);
Expand Down
3 changes: 3 additions & 0 deletions content/search/search.txt
@@ -0,0 +1,3 @@
bypass_cache: true
title: Search Results

42 changes: 42 additions & 0 deletions templates/search.html
@@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>{{ page.title }}, {{ page.name }}'s Portfolio </title>
<link rel="alternate" type="application/atom+xml" href="{{ page.root_path }}/?/feed/">
<link rel="stylesheet" href="{{ page.root_path }}/public/docs/css/screen.css" type="text/css" media="screen">
</head>
<body>
<div id="container" class="{{ page.id }}">
<h1 class="col three">
<a href="{{ page.root_path }}">{{ page.name }}</a>
<strong>{{ page.profession }}</strong>
</h1>
<em class="col three">{{ page.email }}</em>
<hr>
{% include 'partials/navigation/navigation.html' %}
<div id="content" class="col eight">
<p class="date col one">&para;</p>
<div class="description col six">
<h2 class="col six"><a href="{{ page.root_path }}">{{ page.title }}</a></h2>
<form class="logo-bottom three" action="/search">
<input type="text" value="{{ page.query.q }}" name="q" id="search-field" autocomplete="off" spellcheck="false" />
</form>
{% set results = search(page.query.q) %}
{% for result in results %}
<a href="{{ result.url }}">
<h2>{{ result.title }}</h2>
<p>{{ result.search_match }}</p>
</a>
<hr>
{% endfor %}
</div>
</div>
<hr>
<p id="footer" class="col six">&copy; Copyright {{ page.name }} {{ page.current_year }} <a class="atom-rss" href="{{ page.root_path }}/?/feed/">RSS</a><br>
<em>Content managed by <a href="http://www.staceyapp.com">stacey</a></em></p>
</div>
<script src="{{ page.root_path }}/public/docs/js/jquery-1.3.2.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>

0 comments on commit a6f4802

Please sign in to comment.