How to Generate Image Variants with Dancing Goat theme

Mark Joey Lavapie asked on March 29, 2021 23:28

Hello, I installed Dancing Goat theme as a base of our website new website. Along with it are pre-made pages and blog posts, which are great as we use it as our guide.

However, we are having a problem replicating the news' image variants. When we upload a 'Teaser Image' it doesn't generate image variants which results a broken images at the front end.

How can we fix this? Thank you.

Recent Answers


Juraj Ondrus answered on March 30, 2021 06:38

What version and hotfix of Kentico are you using? Also, what is the code you are using to generate the image variants?

0 votesVote for this answer Mark as a Correct answer

Mark Joey Lavapie answered on March 30, 2021 12:07

Actually, I am not using any code. I was under impression that Dancing Goat is ready to use. When I installed the theme, it comes with a few news article with image variations already, so I thought if I create a new post and upload an attachment, it'll automatically generate image variations.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 30, 2021 13:06

Well, what version and hotfix of Kentico are you using? What page type are you creating? As you can see from the documentation, the image variants can be limited per content tree section and/or per page type and so on. So it really depends what and where are you doing when "I create a new post and upload an attachment"...

0 votesVote for this answer Mark as a Correct answer

Mark Joey Lavapie answered on March 30, 2021 13:50

I'm sorry I forgot to include the hotfix. Here you go. v12.0.29

I used DancingGoat.Article page type. Exactly similar to the demo content of Dancing Goat.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 30, 2021 13:59

Thanks, I just tried it and it is working fine - in what section are you creating the page? Anyway, in the sample Dancing Goat project the code is compiled into a DLL. If you want to have your own image variants, you need to follow the documentation I linked in my first post anyway and create custom logic for your page types and your section of the content tree.

0 votesVote for this answer Mark as a Correct answer

Mark Joey Lavapie answered on March 30, 2021 14:13

In what section are you creating the page? Here's the page, It is exactly the same demo page news page of Dancing Goat, I just changed the name and url.

I'm fine with Dancing Goat's image variants, I just want it to work. What to do you think is the problem why its not working for me?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 30, 2021 14:26

Maybe because the page is not in give section of the tree? AS I mentioned, the sample Dancing Goat site uses e.g.:

new AttachmentVariantContextScope()
.OnSite("DancingGoatMvc")
.Type("DancingGoatMvc.Article")
.Path("
/Articles
", PathTypeEnum.Children)

This means that the code works on DancingGoatMVC site (code name), for DancingGoatMvc.Article page type and at the same time the article must be in /Articles section. Please, see the documentation I linked above and create your own image variant filters and variants. There is no magic that it will work on you site just so - you need to do some coding.

0 votesVote for this answer Mark as a Correct answer

Mark Joey Lavapie answered on March 31, 2021 00:32

Thank you, may I know where to add/edit these codes? This is only my first time using Kentico.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 31, 2021 05:12

Please, read through this section of the documentation and you will learn everything you need about how to generate image variants. There is also explained where to place the code and there are also samples.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.