mirror of https://github.com/onweru/compose.git

weru
14.51.2025 fc84589bf6724d8564440c78878e7fe2e9c58ac5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{{- $baseurl := absURL "" }}
{{- $includeLiteYT := false }}
<!-- begin search for liteyoutube shortcode. code borrowed from erichc Nov 2020 https://discourse.gohugo.io/t/automagically-loading-suitable-scripts-in-head/29429/8 -->
{{- if .IsNode }}
  {{- range .Pages }}
    {{- range .Pages }}
    <!-- another recursion because of the "/posts/xyz" structure; does work with category lists -->
      {{- $rawsummary := split .RawContent "<!--more-->" }}
      <!-- prepare for checking only the part of the article that will show up on the list page -->
      {{- if (findRE "liteyoutube" (index $rawsummary 0)) }}
        {{- $includeLiteYT = true }}
      {{- end }}
    {{- end }}
  {{- end }}
{{- end }}
{{- if (.HasShortcode "liteyoutube") }}
  {{- $includeLiteYT = true }}
{{- end }}
{{- if $includeLiteYT }}
  {{- $styles := printf "%s/css/lite-yt-embed.css" $baseurl }}
  {{- $scripts := printf "%s/js/lite-yt-embed.js" $baseurl }}
  <link rel=stylesheet href={{ $styles }}>
  <script src={{ $scripts }}></script>
{{- end -}}