index.xml 5.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Searches on </title>
    <link>http://beta.seedstack.org/search/</link>
    <description>Recent content in Searches on </description>
    <generator>Hugo -- gohugo.io</generator>
    <atom:link href="http://beta.seedstack.org/search/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Results</title>
      <link>http://beta.seedstack.org/search/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>http://beta.seedstack.org/search/</guid>
      <description>&lt;div class=&#34;row&#34;&gt;
    &lt;div class=&#34;col-md-9&#34;&gt;
        &lt;div class=&#34;content-wrapper&#34;&gt;
            &lt;div class=&#34;inner-results&#34;&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
    document.addEventListener(&#39;seedstack&#39;, function () {
        var $inner = $(&#39;.inner-results&#39;),
                query = seedstack.strings.parseQueryString(location);

        function displaySearchAgain(currentQuery) {
            $inner.append(
                    &#39;&lt;form method=&#34;GET&#34; action=&#34;/search&#34;&gt;&#39; +
                    &#39;&lt;div class=&#34;input-group animated fadeInDown&#34;&gt;&#39; +
                    &#39;&lt;input id=&#34;search-again-field&#34; type=&#34;text&#34; class=&#34;form-control&#34; placeholder=&#34;Search again&#34; name=&#34;q&#34;&gt;&#39; +
                    &#39;&lt;span class=&#34;input-group-btn&#34;&gt;&#39; +
                    &#39;&lt;button class=&#34;btn-u&#34; type=&#34;submit&#34;&gt;Go&lt;/button&gt;&#39; +
                    &#39;&lt;/span&gt;&#39; +
                    &#39;&lt;/div&gt;&#39; +
                    &#39;&lt;/form&gt;&#39; +
                    &#39;&lt;br&gt;&#39;
            );
            $(&#39;#search-again-field&#39;).focus().val(currentQuery);
        }

        function displayMessage(message) {
            $inner.append(&#39;&lt;h3&gt;&#39; + message + &#39;&lt;/h3&gt;&#39;);
        }

        if (!(query.q) || query.q.length &lt; 1 || query.q[0] === &#34;&#34;) {
            displayMessage(&#39;No query specified.&#39;);
            displaySearchAgain(&#34;&#34;);
            return;
        }

        seedstack.searchService.search(query.q[0], function (results) {
            if (!results.length) {
                displayMessage(&#39;No search results.&#39;);
                displaySearchAgain(&#34;&#34;);
            } else {
                $(&#39;.title-subheader h3 &gt; a&#39;).text(&#39;Most relevant results for « &#39; + query.q + &#39; »&#39;);
                displaySearchAgain(query.q);

                // compute highlight params
                var highlight = &#39;&#39;;
                query.q[0].replace(/[^\w\s]/g, &#39;&#39;).split(&#39; &#39;).forEach(function (term) {
                    highlight += encodeURIComponent(term) + &#39;&amp;h=&#39;
                });
                if (highlight) {
                    highlight = highlight.substring(0, highlight.length - 3);
                }

                // Only show the ten first results
                results.slice(0, 10).forEach(function (result) {
                    $(&#39;.inner-results&#39;).append(
                            &#39;&lt;h3&gt;&lt;img src=&#34;http://beta.seedstack.org/img/logos/&#39; + result.zone.logo + &#39;&#34;&gt; &lt;a href=&#34;&#39; + result.href + (highlight ? &#39;?h=&#39; + highlight + &#39;&amp;scroll&#39; : &#39;&#39;) + &#39;&#34;&gt;&#39; + result.title + &#39;&lt;/a&gt;&lt;/h3&gt;&#39; +
                            &#39;&lt;ul class=&#34;list-inline up-ul&#34;&gt;&#39; +
                            &#39;&lt;li&gt;&#39; +
                            &#39;In &lt;a href=&#34;&#39; + result.zone.path + &#39;&#34;&gt;&#39; + result.zone.label + &#39;&lt;/a&gt;&#39; +
                            &#39; &lt;i class=&#34;fa fa-caret-right&#34;&gt;&lt;/i&gt; &lt;a href=&#34;&#39; + result.zone.path + &#39;/&#39; + result.section.path + &#39;&#34;&gt;&#39; + result.section.label + &#39;&lt;/a&gt;&#39; +
                            &#39;&lt;/li&gt;&#39; +
                            &#39;&lt;/ul&gt;&#39; +
                            &#39;&lt;p&gt;&#39; + result.summary + &#39;&lt;/p&gt;&#39; +
                            &#39;&lt;div class=&#34;tags&#34;&gt;&#39; +
                            (result.tags ? result.tags.map(function (tag) {
                                return &#39;&lt;a class=&#34;label label-default&#34; href=&#34;http://beta.seedstack.org/tags/&#39; + tag.replace(/ /g, &#39;-&#39;) + &#39;&#34;&gt;&#39; + seedstack.strings.toTitleCase(tag) + &#39;&lt;/a&gt;&lt;/span&gt;&#39;;
                            }).join(&#34; &#34;) : &#39;&#39;) +
                            &#39;&lt;/div&gt;&#39; +
                            &#39;&lt;hr&gt;&#39;
                    );
                });
            }
        }, function () {
            displayMessage(&#39;An error occurred during search, please try again later.&#39;);
        });
    });
&lt;/script&gt;</description>
    </item>
    
  </channel>
</rss>