Page variable to indicate if it is generated by content adapter

Hi, I want to hide some blocks from content generated by adapters, such as my revision module, since there is no such real file on git repo.

image

Currently I’m able using custom param to achieve this, but I wish there will be a official variable to indicate whether the page is generated by content adapter.

Is a file existence check insufficient?

{{ with .File }}
  something
{{ end }}
1 Like

Will try.

The File is non-empty, and it’s Path was pointed to the adapter template, i.e. news/_content.gotmpl.

I can use strings.HasSuffix for now.

This may help. I haven’t tested it:

https://gohugo.io/methods/page/file/#iscontentadapter

1 Like

Thanks a lot, it works, I didn’t notice that there already exist.

Yeah, I forgot about it until a couple of minutes ago.

1 Like

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