{{- define "title" -}}
  {{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
  {{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}

{{- define "content" -}}
  {{- $cse := .Site.Params.cse -}}
  <article class="page single special search">
    <div class="header">
      {{- /* Title */ -}}
      <h1 class="single-title animate__animated animate__pulse animate__faster">{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}</h1>

      {{- /* Subtitle */ -}}
      {{- with .Params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
    </div>

    {{- /* Content */ -}}
    <div class="content" id="content">
      {{- dict "Content" .Content "Ruby" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
    </div>

    {{- /* Google CSE */ -}}
    {{- if eq $cse.engine "google" -}}
      {{- with $cse.google.cx -}}
        <script async defer src="https://cse.google.com/cse.js?cx={{ . }}"></script>
        <div class="gcse-searchbox"></div>
        <div class="gcse-searchresults"></div>
      {{- end -}}
    {{- end -}}

    {{- /* Bing CSE */ -}}
    {{- if eq $cse.engine "bing" -}}
      {{- with $cse.bing.cx -}}
        <script type="text/javascript"
          id="bcs_js_snippet"
          src="https://ui.customsearch.ai/api/ux/rendering-js?customConfig={{ . }}&market=en-US&safeSearch=Moderate&version=latest&q=">
        </script>
      {{- end -}}
    {{- end -}}
  </article>
{{- end -}}
