Condition to find (detect) amp home and single pages

Hi All,

I am trying to call a partial. Within the partial exists conditionals. For the regular HTML pages, conditionals work, but I am not able to find how to apply the same for amp pages.

Example below:

{{ if .IsHome -}}  ::  checks if the page is homepage (works for HTML pages)
{{ if .Site.Pages }}  :: checks if the page is a single page (works for HTML pages)

I want the amp equivalents for the above both. Can someone help me?

Thanks,
Ayan

Duplicate of this topic:

Hi @alexandros, thanks, I did go through the above topic before posting.


A little bit of struggle and I Found the issue: it was because I was using :man_facepalming:

{{- partial "schema.html" | safeHTML -}}  

Using {{- partial "schema.html" . -}} now. Things are working as expected. :open_hands:

For reference both .IsHome and .Site.Pages work without the need to reference amp.

1 Like

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