alternative outputs

It is possible to manager different alternative outputs but you have to include the result in the pages as it is not automatic.

In my use-case, I want to have the pages in the HTML, RSS et JSON formats.

Activating the outputs

To configure the outputs:

 
[outputs]
home = [ "HTML", "RSS", "JSON"]

I want to access those formats from some of my HTML pages.
The templating of the used theme has thus to be customized.

For example, to have the RSS links in all the pages, you must add in the partials that manage the <head> bloc.

{{ with .OutputFormats.Get "rss" -}}
    {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}

I use the theme docdock from Valere JEANTET. So I have to modify the file /layout/custom-head.html.
But this will generate the RSS link for all pages but I don’t want to do this: I will use a flag file in each directory where I want the pages to have the RSS links generated.

 
{{ if (fileExists (printf "%s/_rss.enabled" .Dir)) -}}
...
{{ end -}}

To add a link the JSON file:

{{ with  .OutputFormats.Get "json" -}}
<a href="{{ .Permalink }}">{{ .Name }}</a>
{{- end }}