# Cactus Plus Twittercard Issue

**URL:** <https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657>\
**Category:** Using Themes\
**Created:** [July 16, 2019, 8:04am UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657 "2019-07-16T08:04:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wasim](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wasim/32/9024_2.png) [@wasim](https://discourse.gohugo.io/u/wasim)\
**Post date:** [July 16, 2019, 8:04am UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/1 "2019-07-16T08:04:18Z")

</div>

Hi, can anybody guide on twittercard issue with [https://themes.gohugo.io/hugo-theme-cactus-plus/](https://themes.gohugo.io/hugo-theme-cactus-plus/)? Thank you

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 16, 2019, 12:07pm UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/2 "2019-07-16T12:07:23Z")

</div>

What is the issue?

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [July 17, 2019, 12:40am UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/3 "2019-07-17T00:40:26Z")

</div>

Hey @wasim, cool profile pic. You gotta give us more when you ask questions. Please read [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132) and follow the advice. It will go a long way, and your questions will actually get answered. 🙂

---

<div class="post-metadata">

**Author:** ![wasim](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wasim/32/9024_2.png) [@wasim](https://discourse.gohugo.io/u/wasim)\
**Post date:** [July 17, 2019, 12:48pm UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/4 "2019-07-17T12:48:47Z")

</div>

@davidsneighbour The Twitter card is not working on that website.

Following the source code from the Theme [Github](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/layouts/partials/twitter-cards.html#L1):

```
{{ if .IsPage }}
  {{ with .Params.images }}
<!-- Twitter summary card with large image must be at least 280x150px -->
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/>
{{ else }}
<meta name="twitter:card" content="summary"/>
{{ if .Site.Params.twitterCardImage }}
  <meta name="twitter:image" content="{{ .Site.Params.twitterCardImage | absURL }}" />
  {{ else }}
  <meta name="twitter:image" content="{{ .Site.BaseURL }}images/avatar.png" />
{{ end }}
  {{ end }}
  <!-- Twitter Card data -->
  <meta name="twitter:title" content="{{ .Title }}"/>
  <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/>
  {{ with .Site.Params.twitter }}
<meta name="twitter:site" content="@{{ . }}"/>
  {{ end }}
  {{ range .Site.Authors }}
{{ with .twitter }}
  <meta name="twitter:creator" content="@{{ . }}"/>
{{ end }}
  {{ end }}
  <!-- no post authors, show site author -->
  {{ if eq (len .Site.Authors) 0 }}
<meta name="twitter:creator" content="@{{ .Site.Params.author }}"/>
  {{ end }}

{{ else }}

  <meta name="twitter:card" content="summary" />
  {{ with .Site.Params.twitter }}
<meta name="twitter:site" content="@{{ . }}"/>
  {{ end }}
  {{ with .Site.Params.author }}
<meta name="twitter:creator" content="@{{ . }}"/>
  {{ end }}
  <meta name="twitter:title" content="{{ .Site.Title }}"/>
  <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/>
  {{ if .Site.Params.twitterCardImage }}
<meta name="twitter:image" content="{{ .Site.Params.twitterCardImage | absURL }}" />
{{ else }}
<meta name="twitter:image" content="{{ .Site.BaseURL }}images/avatar.png" />
  {{ end }}
{{ end }}

```

It also used the following in the .toml file. Please see it at this [link](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml#L35):

```
enableTwitterCard = true
# The url for twitter card image, default is avatar.png in static/images directory
twitterCardImage = ""

```

@maiki I am sorry I didn’t realize that when I was posting, you are right. Thanks for the compliment.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 17, 2019, 12:53pm UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/5 "2019-07-17T12:53:46Z")

</div>

The card is not working because you did not define images.

`twitterCardImage` in your config.toml should be an image that is used if you have no other images defined.

Then in your content files you can define `images` in your front matter and the first image is used for a large image twitter card.

```auto
---
images:
- path/to/image.jpg
- another/image.jpg
---

```

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 17, 2019, 1:13pm UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/7 "2019-07-17T13:13:57Z")

</div>

You have it disabled:

> <https://github.com/wasim-ullah/wasim/blob/master/themes/cactus/layouts/partials/head.html#L7>

remove the comments around the code, then set `enableTwitterCard` in your config.toml to `true`.

It should work then. the file reference for the default image is right.

---

<div class="post-metadata">

**Author:** ![wasim](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wasim/32/9024_2.png) [@wasim](https://discourse.gohugo.io/u/wasim)\
**Post date:** [July 17, 2019, 1:27pm UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/8 "2019-07-17T13:27:52Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![wasim](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wasim/32/9024_2.png) [@wasim](https://discourse.gohugo.io/u/wasim)\
**Post date:** [July 20, 2019, 10:28am UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/9 "2019-07-20T10:28:01Z")

</div>

Can I ask it again? The twittercard (preview) image is still appearing smaller square, than in a larger landscape. Thanks a bunch.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 20, 2019, 11:16pm UTC](https://discourse.gohugo.io/t/cactus-plus-twittercard-issue/19657/10 "2019-07-20T23:16:18Z")

</div>

I am not sure what could cause this, but I would do the following: Go to [https://cards-dev.twitter.com/validator](https://cards-dev.twitter.com/validator), enter your URL and see what Twitter themself have to say about the issue. Maybe it’s “normal” 😉
