Adding buttons to a page

Jeff Klunder asked on July 10, 2017 18:49

Hi,

I'm trying to create a button which the I can add to pages. What I did was creating a page type with some fields (button text, button link) and now I can select a page and add this page type.

But here's the problem I'm facing now: on the page I inserted a repeater to add the page type. Only when I create multiple buttons (page types) they all show up in the webpart container. Sounds sort of logical to me, hence the repeater.

Is there a way in which I can create multiple buttons and place them where I want inside the page? So for example place button A on top of the page and button B at the bottom?

Recent Answers


Jeff Klunder answered on July 10, 2017 19:37 (last edited on July 11, 2017 08:58)

For those who are searching for the solution on this: I fixed it by adding the following in the WHERE condition input field of the repeater:

cta_position LIKE 1
// this displays the first page type under the parent page; 
// 2 displays the second and so on
// cta_position is the name of the pagetype field
0 votesVote for this answer Mark as a Correct answer

Mike Wills answered on July 10, 2017 20:01 (last edited on July 10, 2017 20:02)

Hi Jeff,

If you like using page types to represent various content elements (I do), you might like the approach of defining more of your page's content as child content. This would allow you to query all the content for your page with one Hierarchical Viewer -- that is, with one database round trip. And in the case of your buttons, it would allow you to rearrange the buttons and the rest of your content by changing the node order in the content tree. If you adopt this approach, the nodes for one page might look like this:

Page
∟Page content
    ∟Hero section
        ∟Hero 1
        ∟Hero 2
    ∟Call to Action 1
    ∟Detail section
    ∟Call to Action 2

I learned this approach from Brenden Kehren here, and Joel Dahlin here. Kentico Support guided a coworker to use the same approach, saying it "will also fall in line with our best practices."

Here's a slide deck that gives some more benefits and tips for this approach. https://www.slideshare.net/mikewills/kentico-content-architecture-the-inaugural-seattle-kentico-users-group-may-2017

Mike

0 votesVote for this answer Mark as a Correct answer

Jeff Klunder answered on July 11, 2017 08:59

Hi Mike,

For now we solved the issue, but when I have time I will look a bit closer to your answer.

0 votesVote for this answer Mark as a Correct answer

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