nban22 / Newspaper

Newspaper Web App: A dynamic online news platform with roles for guests, subscribers, writers, editors, and admins. Features include full-text search, category/tag filters, premium article access, WYSIWYG editor, and secure authentication using Express.js, TypeScript, MongoDB, and EJS
0 stars 0 forks source link

[Article Details] Related Articles #10

Open nban22 opened 1 week ago

nban22 commented 1 week ago

Objective

Fetch and display 5 random articles from the same category as the currently viewed article, to provide users with related content.


Requirements

  1. Query for Related Articles

    • After fetching the full article details, query the database for 5 random articles that belong to the same category as the current article.
    • Ensure that the related articles are selected from the same category but exclude the current article from the results.
  2. Display Related Articles

    • Render the 5 related articles on the article detail page, preferably below the main article content.
    • Each related article should include:
      • Title
      • Thumbnail image
      • Publish date
      • Category
    • Ensure the related articles are clearly marked as "Related Articles" or similar.
  3. User Interaction

    • Make the related articles clickable, leading to their own detail pages.
    • Ensure that users can easily navigate to these related articles to continue browsing similar content.
  4. Styling and Layout

    • Display the related articles in a clean, visually distinct section, separate from the main content of the article.
    • Ensure that the layout of the related articles is visually appealing and does not distract from the main content.
  5. Random Selection

    • Implement logic to fetch a random selection of articles from the same category, ensuring a varied list each time a user views an article.
    • Consider ensuring that the same article doesn’t appear in both the main article and the related articles list.

Deliverables


Acceptance Criteria