How do news sites prevent duplicate articles from showing up on homepage?
News sites usually have a featured section and some category based news. The featured articles belong to a category but when they're featured they don't show up in the category section - what's the common way of doing this? Should I save a list of all the articles that are featured, then grab the latest news from each category, except prune out the ones that were pulled as the featured articles? Or is there another cleaner way of doing this?
Example:
FEATURED:
Michael Jordan and the bulls win Championship!
SPORTS:
Broncos win the superbowl!
The sports won't feature the featured article until it's no longe开发者_Python百科r featured.
- have a
featured
column featured_from
andfeatured_to
columns
The benefit of specifying a date span in option #2 means you don't have to manually change it over
If the articles are specifically set to be feature articles you can just exclude them when selecting your section articles.
If they aren't specifically set and are randomlly selected each time the page is displayed you wil lneed to prune them out of the section article queries (NOT IN ... ) etc.
精彩评论