Is it correct that it is not possible to have an event.ics for a single event?
The documentation only lists list templates.
What I would like to achieve is to have single ics-files for all events in my site.
Is it correct that it is not possible to have an event.ics for a single event?
The documentation only lists list templates.
What I would like to achieve is to have single ics-files for all events in my site.
Yes you can and I guess there are several ways to go about it, but what I would do is:
/layouts/_default/single.ics
outputs = ["HTML", "Calendar"]
to the front matter.That should work.
Thanks, this works. But I am not able to insert a link to the index.ics file.
Code from here does not work:
I tried this with “Calendar” and “calendar”
{{ with .OutputFormats.Get "Calendar" -}}
<a href="{{ .Permalink }}">{{ .Name }}</a>
{{- end }}
but always get the #ZgotmplZ thing.
I have a working link in head with this:
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
There is a missing safeURL
{{ with .OutputFormats.Get "calendar" -}}
<a href="{{ .Permalink | safeURL }}">{{ .Name }}</a>
{{- end }}
This works.
@juh2 When you have this up and running, would you be so kind as to share the full source? I would like to add more examples to that specific area of the docs…
Here’s an ics template that’s working for me.
https://github.com/zivbk1/islandview-pta-site/blob/master/site/layouts/_default/event.ics
@rdwatters This is all the code I use, so far.
I am currently struggling with the webcal protocol which does not work in a reasonable way on my computer. Maybe I messed something up. What are your experiences with webcal. Any complaints from users?
As the webcal protocol is not suitable for my single events, I configured hugo to use the http protocol instead.
I encountered something strange.
When I used the example from the docs like this:
[outputFormats.Calendar]
mediaType = "text/calendar+ics"
baseName = "event"
isPlainText = true
protocol = "http://"
I get the error:
Error: Error building site: error decoding '': media type "text/calendar+ics" not found
I thought, ok let’s define the media type anyway.
[mediaTypes]
[mediaTypes."text/calendar+ics"]
suffix = "ics"
[outputFormats.Calendar]
mediaType = "text/calendar+ics"
baseName = "termin"
isPlainText = true
protocol = "http://"
But with this I get the error:
Error: Error building site: media type keys cannot contain any '+' chars. Valid example is "text/css"
Finally this works:
[outputFormats.Calendar]
baseName = "termin"
isPlainText = true
protocol = "http://"
Obviously you only have to redefine the custom part of your output format. In my case the basename and the protocol. I guess I could have skipped the isPlainText part.
Perhaps you can add a paragraph about customizing output formats.
It seems to have moved: I think this is still working
Thank you, yes the project moved to the organization and out of my personal projects.
Do you have a updated link to the calendar partial code, because that repo seems to be gone.
I am working on a Hugo website and want something like this layout where you can click on things to get a description (I don’t care about the tags though):
That just looks like a list page with card styles for each event entry. What I was doing before was building .ics and .json files for events that could be used in a calendar style layout and for a link that people could add to their calendar application on desktop, Google Calendar, etc.
What you are showing doesn’t seem to require the extra stuff I was doing.
I ended up getting rid of event content on the site and so the current state of the master branch is missing that code. Here is the commit where the files were present.
Ok, it seems I should just use some sort of thing similar to blog posts.