# Condition to find (detect) amp home and single pages

**URL:** https://discourse.gohugo.io/t/condition-to-find-detect-amp-home-and-single-pages/31866
**Category:** support
**Created:** [March 20, 2021, 4:30pm UTC](https://discourse.gohugo.io/t/condition-to-find-detect-amp-home-and-single-pages/31866 "2021-03-20T16:30:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![do2blehelix](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@do2blehelix](https://discourse.gohugo.io/u/do2blehelix)
#### Post date: [March 20, 2021, 4:30pm UTC](https://discourse.gohugo.io/t/condition-to-find-detect-amp-home-and-single-pages/31866/1 "2021-03-20T16:30:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [March 20, 2021, 8:10pm UTC](https://discourse.gohugo.io/t/condition-to-find-detect-amp-home-and-single-pages/31866/2 "2021-03-20T20:10:57Z")

</div>

Duplicate of this topic:

> [@Detect if Amp Page](https://discourse.gohugo.io/t/detect-if-amp-page/20167):
>
> Is there a shortcode to check if is amp page? My issue is that I am using html tags in my markdown (don’t shoot me). and for amp pages I need to use a different markup for images. What is the syntax for “If amp page” ?

---

<div class="post-metadata">

### Author: ![do2blehelix](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@do2blehelix](https://discourse.gohugo.io/u/do2blehelix)
#### Post date: [March 21, 2021, 2:34pm UTC](https://discourse.gohugo.io/t/condition-to-find-detect-amp-home-and-single-pages/31866/3 "2021-03-21T14:34:42Z")

</div>

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 🤦‍♂️

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

```

Using `{{- partial "schema.html" . -}}` now. Things are working as expected. 👐

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

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)
#### Post date: [March 23, 2021, 2:35pm UTC](https://discourse.gohugo.io/t/condition-to-find-detect-amp-home-and-single-pages/31866/4 "2021-03-23T14:35:23Z")

</div>

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