I’m currently trying to access all .ics Calendar Files located in the same Folder where my Shortcode is applied like so:
{{ range .Page.Resources.ByType "text/calendar" }}
<p>{{ .RelPermalink }}</p>
{{ end }}
but it does not work (nothing listed).
as a test, I also changed ‘text/calendar’ with ‘image’ as there are also images in the Folder, that works.
so, I have the impression that Hugo does not recognize MIME Type text/calendar (which is listed as a common type at Mozilla.
Could that be right, or am I just missing something ?
Returns a collection of page resources of the given media type, or nil if none found. The media type is typically one of image , text , audio , video , or application .
there’s a subtile distinction between MIME and Media Type
Maybe the docs could be clearer here about using the “MainType” only (same for image - “image/jpeg” won’t work
Try this one
{{ range (.Resources.ByType "text") }}
<h2>{{ . }}</h2>
{{ highlight (debug.Dump .MediaType) "JSON" }}
{{ end }}