How to check if an output format is declared?

Hello Awesome Developers,

I want to check if an output format is declared or not. if declared, then I am going to do something like this

{{ if "WebAppManifest" "in" site.Outputs.home }}
<link rel="manifest" href="{{`manifest.webmanifest` | absURL}}">
{{ end }}

Is anything possible like this?

That is not possible currently. outputs and outputFormats are not available to the template process.

What you COULD try is to range through .AlternativeOutputFormats per page and check there, if it’s an WebAppManifest as type. But I never tried that.

I add my manifest-link manually and trust myself to have this output format. If you find a solution let us know :slight_smile:

2 Likes

What you can do is:

{{ with  site.Home.OutputFormats.Get "WebAppManifest" -}}
<link rel="manifest" href="{{ .Permalink }}">
{{- end }}
4 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.