How do news sites prevent duplicate articles from appearing on the homepage?

News sites usually have a special section and news with a specific category. Selected articles are categorized, but when they are displayed, they are not displayed in the category section - what is the general way to do this? Should I keep a list of all the articles that are submitted, and then grab the latest news from each category, except those that have been pulled out as recognized articles? Or is there another cleaner way to do this?

Example:

THE BEST:

Michael Jordan and the bulls won the championship!

SPORTS:

The Broncos will win the Super Bowl!

An article will not be shown in sports until it is no longer submitted.

+4
source share
2 answers

If articles are specifically configured as articles for articles, you can simply exclude them when selecting articles in a section.

If they are not specially configured and are selected randomly every time the page is displayed, you need to cut them out of the section article requests (NOT IN ...), etc.

+2
source
  • have featured column
  • featured_from and featured_to columns

The advantage of specifying a date range in option No. 2 means that you do not need to manually change it over

+1
source

Source: https://habr.com/ru/post/1303189/


All Articles