promote or "pin" news to homepage

Dennis Hulsmans asked on March 9, 2016 13:15

Hi

I want to promote (or pin) some items (not necessarily the most recent items) to the homepage news teaser.

In another CMS there is a property called "show on homepage". I can do it the same way, but then I'll have to create a custom page type (inherited from the default CMS.News), which may not be the best way. So maybe there are other solutions to solve this, instead of creating a custom page type with just 1 extra field.

kind regards, Dennis

Correct Answer

Joshua Adams answered on March 9, 2016 15:24

You can just add another field of the type boolean, if checked, then pin it to the home page. All the show on homepage does is determine to show it on the home page by reading in that boolean, if true, then it shows, if false then it doesn't. After you add that field, then go to your where clause and add your condition.

Usually best practice is to clone the code files, but with built in document types, usually you are ok to add your own fields. I usually won't delete fields though, just to be on the safe side. Also, cloning that document type isn't a large effort at all by any means or even creating your own. If you have the time, why not go ahead and do that, then you can protect yourself against future upgrades.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Zach Perry answered on March 9, 2016 16:03

You can also create a custom page type, inherit from CMS.News, then add your own field if you don't want to modify the original.

2 votesVote for this answer Mark as a Correct answer

Dennis Hulsmans answered on March 9, 2016 16:47

Joshua, Zachary

Thanks for the answer, that was the one solution I had in mind, but maybe there was an "easier" way of doing this. Just because there is a news page type. I didn't want to "inherit" or "clone" from the already existing page type, just to save some time :)

0 votesVote for this answer Mark as a Correct answer

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