Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Featured Stories #1479

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Conversation

ibrahimjaved12
Copy link
Contributor

@ibrahimjaved12 ibrahimjaved12 commented Dec 26, 2024

What are the relevant tickets?

Part of https://github.com/mitodl/hq/issues/6029

Description (What does it do?)

This PR adds featured stories on display for OCW.

  • Homepage & List page: If no featured story is selected (in backend), then it defaults to showing all stories instead.
  • Single story page 'More Stories': First 4 featured stories will be shown in sidebar (if they exist). If no featured stories exist, then it defaults to showing 4 stories randomly. However, if less than 4 featured stories exist, then the exact number (less than 4) will be shown.
    • Added condition to not show same opened story in sidebar for More Stories. Eg. Sidebar is supposed to show first 4 featured stories, and if one of them is opened currently, then it won't be included in the 4, the next story would then be displayed.

Screenshots (if appropriate):

image

How can this be tested?

This must be reviewed together with: mitodl/ocw-hugo-projects#311

  1. Spin up OCW Studio locally
  2. Add the code from this ocw-hugo-projects branch to your local ocw-www website-starter from admin panel.
  3. Go to homepage settings from Studio: http://localhost:8043/sites/ocw-www/type/homepage/
  4. You should now see featured stories there. Select a few and order them as you like. Make sure the same stories are also present in your ocw-hugo-themes www theme directory locally.
  5. Click on save.
  6. Go to your github organization linked with your local ocw studio, and go to the homepage.yaml file in the ocw-www repository, eg. in my case it is: https://github.com/ibrahimjaved12org/ocw-www/blob/main/data/homepage.yaml
  7. It should have featured stories. Copy the code so you can now paste it in your local ocw-content-rc directory in the same file linked with your setup of ocw-hugo-themes.
  8. Paste it in your local homepage.yaml file in your ocw-www content directory as mentioned above.
  9. Now spin up ocw-hugo-themes: yarn start www
  10. Go to homepage: http://localhost:3000/
  11. Make sure the stories are displayed in correct order!

@github-actions github-actions bot temporarily deployed to pull request December 26, 2024 14:27 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 26, 2024 14:28 Inactive
Copy link

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions github-actions bot temporarily deployed to pull request December 27, 2024 08:33 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 27, 2024 08:33 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 27, 2024 13:56 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 27, 2024 13:56 Inactive
@umar8hassan umar8hassan self-assigned this Jan 3, 2025
Copy link
Contributor

@umar8hassan umar8hassan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ibrahimjaved12 ibrahimjaved12 merged commit 9e5c5dd into main Jan 6, 2025
8 checks passed
@ibrahimjaved12 ibrahimjaved12 deleted the ibrahim/6029/featured-stories branch January 6, 2025 07:38
@odlbot odlbot mentioned this pull request Jan 6, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants