<!--% page_title = "HPR ~ Find a show" %-->
<section id="search">
	<header>
		<h1>Search HPR.</h1>
	</header>
	<div class="lane">
		<form method="get" id="search" action="https://duckduckgo.com/">
			<fieldset><legend>DuckDuckGo</legend>
			<input type="hidden" name="sites" value="https://www.hackerpublicradio.org/"/>
			<input type="hidden" name="k8" value="#444444"/>
			<input type="hidden" name="k9" value="#D51920"/>
			<input type="hidden" name="kt" value="h"/>
			<input type="text" name="q" maxlength="255" placeholder="Search HPR with DuckDuckGo"/>
			<input type="submit" value="Search HPR with DuckDuckGo" />
			<p>
			<a href="https://duckduckgo.com/privacy">privacy policy</a>
			</p>
			</fieldset>
		</form>
		<form name="google-search" method="get" action="https://www.google.com/search">
			<fieldset><legend>Google</legend>
				<input type="hidden" name="sitesearch" value="https://www.hackerpublicradio.org/" />
				<input name="q" type="text" placeholder="Search HPR with Google"/>
				<input type="submit" name="sa" value="Search HPR with Google" />
				<p>
				<a href="https://www.google.com/policies/privacy/">privacy policy</a>
				</p>
			</fieldset>
		</form>
		<form method="get" action="https://www.bing.com/search">
			<fieldset><legend>Bing</legend>
				<input type="hidden" name="cp" value="utf-8" />
				<input type="hidden" name="FORM" value="FREESS" />
				<input type="text" name="q" size="30" placeholder="Search HPR with Bing"/>
				<input type="submit" value="Search HPR with Bing" />
				<input type="hidden" name="q1" value="site:www.hackerpublicradio.org" />
				<p>
				<a href="https://www.microsoft.com/privacystatement/en-us/bing/default.aspx">privacy policy</a>
				</p>
			</fieldset>
		</form>
	</div>
</section>
<section id="tags">
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-tags.tpl.html" %-->
<!--% USE DBI(constants.driver) %-->
<!--% PERL %-->
$Template::Stash::PRIVATE = undef; # Allow . in tag
<!--% END %-->
<!--% USE String %-->
<!--% uniq_tag_count = 0 %-->
<!--% FOREACH episode IN DBI.query(query_tags);
    ep_id = episode.id;
    ep_tags = episode.tags;
    FOREACH tag_str IN ep_tags.csv_parse;
        NEXT UNLESS tag_str;
        NEXT IF tag_str == '';
        tag = tag_str.lower;
		tag_index = String.new(tag).push('_');
        first_char = tag.substr(0,1);
        IF first_char == '.';
            first_char = '&#x0002E;'; # Unicode .
        END;
        IF all_tags.${first_char}.exists(tag_index);
            all_tags.${first_char}.${tag_index}.count = all_tags.${first_char}.${tag_index}.count + 1;
            all_tags.${first_char}.${tag_index}.urls.push(ep_id);
        ELSE;
            all_tags.${first_char}.${tag_index}.count = 1;
            uniq_tag_count = uniq_tag_count + 1;
            all_tags.${first_char}.${tag_index}.urls = [ep_id];
        END;
    END;
END %-->
<!--% USE date %-->
<!--% all_first = ['#','&#x0002E;','/','0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] %-->
<header>
	<hgroup>
	<h1 id="TOP" class="title">Search by Tag</h1>
	<p class="date">Generated on <!--% date.format(date.now, format => '%Y-%m-%d at %H:%M:%S UTC', gmt => 1) %--></p>
	</hgroup>
</header>
	<p>This section summarises all of the tags currently used throughout the
	database. The tags are in alphabetical order and each is followed by links to
	the show numbers where it is used so you can see the context the author used
	it in. There are currently <!--% uniq_tag_count %--> unique tags in the system.</p>
	<h4>Alphabetical index</h4>
	<p>This is an index to the initial letters of the tags below.</p>
	<ul id="tag_initial_letter_index">
    <!--% FOREACH first_char IN all_first %-->
        <!--% IF all_tags.${first_char} %-->
            <li><a href="<!--% absolute_path(baseurl) %-->search.html#<!--% tag_to_id(String.new(all_tags.${first_char}.keys.sort.first).chop) %-->"><strong><!--% first_char %--></strong></a></li>
        <!--% END %-->
    <!--% END %-->
	</ul>
	<hr class="no-css">
    <!--% FOREACH first_char IN all_first %-->
        <!--% IF all_tags.${first_char} %-->
		<p class="index-link"><a href="<!--% absolute_path(baseurl) %-->search.html#TOP">&UpArrow; Go to index</a></p>
	        <h3>Tags beginning with '<!--% first_char %-->'</h3>
	        <ul class="tag-index">
                <!--% FOREACH tag_index IN all_tags.${first_char}.keys.sort %-->
				<!--% tag = String.new(tag_index).chop; tag_id = String.new(tag_index).chop; %-->
    	        	<li>
    	        		<a id="<!--% tag_to_id(tag_id) %-->"><strong><!--% tag %--></strong></a>: 
                        <!--% ep_links = [] %-->
                        <!--% FOREACH ep_id IN all_tags.${first_char}.${tag_index}.urls.nsort;
							ep_links.push("<a href=\"${absolute_path(baseurl)}eps/hpr" _ zero_pad_left(ep_id) _ '/index.html"'
                                ' target="_blank" aria-label="' _ tag _
                                ' - show ' _ ep_id _ '">' _ ep_id _ '</a>');
                        END %-->
                        <!--% ep_links.join(', ') %-->
    	        	</li>
                <!--% END %-->
	        </ul>
        <!--% END %-->
    <!--% END %-->
	<p><a href="#TOP">Go to TOP of page</a></p>
</article>
<!--% PERL %-->
$Template::Stash::PRIVATE = 1;
<!--% END %-->

</section>
