<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode | default "en" }}">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    
    {{/* Generate consistent title */}}
    {{ $title := "" }}
    {{ if .Params.narrator }}
      {{ $title = printf "%s: %s" .Params.narrator .Params.subject }}
    {{ else if .IsHome }}
      {{ $title = .Title }}
    {{ else }}
      {{ $title = printf "%s - %s" .Title .Site.Title }}
    {{ end }}
    
    <!-- Basic SEO -->
    <title>{{ $title }}</title>
    
    {{/* Generate description from summary, description, or default site description */}}
    {{ $description := "" }}
    {{ with .Description }}
      {{ $description = . }}
    {{ else }}
      {{ with .Summary }}
        {{ $description = . | plainify | truncate 160 }}
      {{ else }}
        {{ $description = .Site.Params.description }}
      {{ end }}
    {{ end }}
    <meta name="description" content="{{ $description }}" />
    
    {{/* Generate keywords from topics */}}
    {{ with .Params.topics }}
    <meta name="keywords" content="{{ delimit . ", " }}" />
    {{ end }}
    
    <!-- Open Graph / Facebook -->
    <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
    <meta property="og:url" content="{{ .Permalink }}" />
    <meta property="og:title" content="{{ $title }}" />
    <meta property="og:description" content="{{ $description }}" />
    {{ with .Params.images | default .Site.Params.images }}
    <meta property="og:image" content="{{ index . 0 | absURL }}" />
    {{ end }}
    {{ with .Site.Params.facebookAppID }}
    <meta property="fb:app_id" content="{{ . }}" />
    {{ end }}
    
    <!-- Twitter -->
    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="{{ $title }}" />
    <meta name="twitter:description" content="{{ $description }}" />
    {{ with .Params.images }}
    <meta name="twitter:image" content="{{ index . 0 | absURL }}" />
    {{ end }}
    
    <!-- Article Specific -->
    {{ if and .IsPage (eq .Type "articles") }}
    <meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
    <meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" />
    <meta property="article:section" content="Oral History" />
    {{ with .Params.topics }}
    {{ range . }}
    <meta property="article:tag" content="{{ . }}" />
    {{ end }}
    
    {{ end }}
    
    {{/* Author information using standard meta topics instead of article:author */}}
    {{ with .Params.narrator }}
    <meta name="author" content="{{ . }}" />
    {{ end }}
    {{ with .Params.facilitator }}
    <meta name="interviewer" content="{{ . }}" />
    {{ end }}
    {{ end }}
    
    <!-- Canonical URL -->
    <link rel="canonical" href="{{ .Permalink }}" />
    
    <!-- CSS Variables and Styles -->
    {{ partial "css-variables.html" . }}
    
    {{/* Main Styles */}}
    {{ $styles := resources.Get "scss/main.scss" }}
    {{ $styles = $styles | resources.ToCSS (dict "targetPath" "css/styles.css" "enableSourceMap" true) }}
    {{ $styles = $styles | resources.PostCSS }}
    
    {{ if hugo.IsProduction }}
      {{ $styles = $styles | minify | fingerprint | resources.PostProcess }}
    {{ end }}
    
    <link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
  </head>
  <body class="">
    {{ partial "header.html" . }}
    <div class="px-4 lg:mx-auto">
      {{ block "main" . }}{{ end }}
    </div>
    <script src="/js/sigil.js"></script>
    <script src="/js/colorCalculator.js"></script>
    <script src="/js/wompum.js"></script>
  </body>
</html>