Skip to content

Conversation

@Nabeel1276
Copy link
Contributor

@Nabeel1276 Nabeel1276 commented Jan 7, 2026

Resolves JIRA: https://bbc.atlassian.net/browse/WS-1943

Summary

Created new route in Simorgh to render topic pages in NextJS app

Code changes

  • Added new route to the Next.js app to support Topic pages, reusing existing data fetching logic from express.
  • The constructPageFetchUrl function was updated so local Topic pages fetch data from the Next.js API.
  • Updated local topic page URL to reflect a correct asset route structure for topics, using the correct topic ID.

Developer Checklist

  • UX
    • UX Criteria met (visual UX & screenreader UX)
  • Accessibility
    • Accessibility Acceptance Criteria met
    • Accessibility swarm completed
    • Component Health updated
    • P1 accessibility bugs resolved
    • P2/P3 accessibility bugs planned (if not resolved)
  • Security
    • Security issues addressed
    • Threat Model updated
  • Documentation
    • Docs updated (runbook, READMEs)
  • Testing
    • Feature tested on relevant environments
  • Comms
    • Relevant parties notified of changes

Testing

  • Manual Testing required?
    • Local (Ready-For-Test, Local)
    • Test (Ready-For-Test, Test)
    • Preview (Ready-For-Test, Preview)
    • Live (Ready-For-Test, Live)
  • Manual Testing complete?
    • Local
    • Test
    • Preview
    • Live

Additional Testing Steps

  1. List the steps required to test this PR.

Useful Links

page,
service,
variant,
rendererEnv,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would maybe retain similar behaviour to the current implementation here:

const overrideRendererEnv = pathname => {
if (isTest()) {
const url = Url(pathname, true);
if (!url.query.renderer_env) {
url.query.renderer_env = 'live';
}
return url.toString();
}
return pathname;
};

Not necessarily exactly this, but something like:

- if isTest AND no renderer_env then renderer_env = 'live'
- else
- use rendererEnv from context.query

Copy link
Contributor

Choose a reason for hiding this comment

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

This is unique to topics, so just want to make sure we don't break e2es or anything by omitting this behaviour as it stands.

| **Nepali** | [Article](http://localhost:7081/nepali/articles/cl90j9m3mn6o)<br />[Home](http://localhost:7080/nepali)<br />[Live Radio](http://localhost:7080/nepali/bbc_nepali_radio/liveradio)<br />[MAP](http://localhost:7081/nepali/media-23269034)<br />[TC2 MAP](http://localhost:7081/nepali/multimedia/2016/07/160725_tc2_testmap1)<br />[Most Read](http://localhost:7080/nepali/popular/read)<br />[On Demand Audio (Brand)](http://localhost:7080/nepali/bbc_nepali_radio/w172x83pnptp1s8)<br />[Podcast (Episode)](http://localhost:7080/nepali/podcasts/p02pc9w3/p086v2bv)<br />[Podcast (Brand)](http://localhost:7080/nepali/podcasts/p02pc9w3)<br />[PGL](http://localhost:7081/nepali/news-50627370)<br />[Topic](http://localhost:7080/nepali/topics/cp2d78r6qppt) | [Article](https://www.test.bbc.com/nepali/articles/cl90j9m3mn6o)<br />[Home](https://www.test.bbc.com/nepali)<br />[Live Radio](https://www.test.bbc.com/nepali/bbc_nepali_radio/liveradio?renderer_env=live)<br />[MAP](https://www.test.bbc.com/nepali/media-23269034)<br />[TC2 MAP](https://www.test.bbc.com/nepali/multimedia/2016/07/160725_tc2_testmap1)<br />[Most Read](https://www.test.bbc.com/nepali/popular/read)<br />[On Demand Audio (Brand)](https://www.test.bbc.com/nepali/bbc_nepali_radio/programmes/p0340xzt)<br />[On Demand Audio (Episode)](https://www.test.bbc.com/nepali/bbc_nepali_radio/w172xzcfvptk838)<br />[Podcast (Episode)](https://www.test.bbc.com/nepali/podcasts/p02pc9w3/p09j0dm5)<br />[Podcast (Brand)](https://www.test.bbc.com/nepali/podcasts/p02pc9w3)<br />[PGL](https://www.test.bbc.com/nepali/news-23093383)<br />[STY](https://www.test.bbc.com/nepali/23210795)<br />[Topic](https://www.test.bbc.com/nepali/topics/cp2d78r6qppt) | [Article](https://www.bbc.com/nepali/articles/c16ljg1v008o)<br />[Home](https://www.bbc.com/nepali)<br />[Live Radio](https://www.bbc.com/nepali/bbc_nepali_radio/liveradio)<br />[MAP](https://www.bbc.com/nepali/news-51675223)<br />[TC2 MAP](https://www.bbc.com/nepali/multimedia/2013/08/130806_boudhavideo)<br />[Most Read](https://www.bbc.com/nepali/popular/read)<br />[On Demand Audio (Brand)](https://www.bbc.com/nepali/bbc_nepali_radio/programmes/p0340xzt)<br />[On Demand Audio (Episode)](https://www.bbc.com/nepali/bbc_nepali_radio/w172xzcfvptk838)<br />[Podcast (Episode)](https://www.bbc.com/nepali/podcasts/p02pc9w3/p09j0dm5)<br />[Podcast Brand)](https://www.bbc.com/nepali/podcasts/p02pc9w3)<br />[PGL](https://www.bbc.com/nepali/news-50627370)<br />[STY](https://www.bbc.com/nepali/news-53409873)<br />[Topic](https://www.bbc.com/nepali/topics/cp2d78r6qppt) |
| **News** | [Article](http://localhost:7081/news/articles/cn7k01xp8kxo.amp)<br />[STY](http://localhost:7081/news/uk-56342465.amp)<br />[STY 2](http://localhost:7081/news/technology-56294493.amp) | [Article](https://www.test.bbc.com/news/articles/cn7k01xp8kxo.amp)<br />[STY](https://www.test.bbc.com/news/23393110.amp) | [Article](https://www.bbc.com/news/articles/cj7xrxz0e8zo.amp)<br />[STY](https://www.bbc.com/news/uk-56342465.amp)<br />[STY 2](https://www.bbc.com/news/technology-56294493.amp) |
| **Newsround** | [STY](http://localhost:7081/newsround/56331357.amp) | [STY](https://www.test.bbc.com/newsround/23212028.amp) | [STY](https://www.bbc.com/newsround/56331357.amp) |
| **Pashto** | [Article](http://localhost:7081/pashto/articles/cyjmdl92z3ro)<br />[Home](http://localhost:7080/pashto)<br />[Live Radio](http://localhost:7080/pashto/bbc_pashto_radio/liveradio)<br />[MAP](http://localhost:7081/pashto/media-23257523)<br />[TC2 MAP](http://localhost:7081/pashto/world/2016/09/160921_tc2_testmap1)<br />[Most Read](http://localhost:7080/pashto/popular/read)<br />[On Demand Audio (Brand)](http://localhost:7080/pashto/bbc_pashto_radio/w3ct0lz1)<br />[On Demand TV (Brand)](http://localhost:7080/pashto/bbc_pashto_tv/tv_programmes/w13xttn4)<br />[On Demand TV (Episode)](http://localhost:7080/pashto/bbc_pashto_tv/tv/w172xcldhhrhmcf)<br />[PGL](http://localhost:7081/pashto/arts-and-literature-50230813)<br />[STY](http://localhost:7081/pashto/23289748)<br />[Topic](http://localhost:7080/pashto/topics/cr50y57xj52t) | [Article](https://www.test.bbc.com/pashto/articles/cyjmdl92z3ro)<br />[Home](https://www.test.bbc.com/pashto)<br />[Live Radio](https://www.test.bbc.com/pashto/bbc_pashto_radio/liveradio?renderer_env=live)<br />[MAP](https://www.test.bbc.com/pashto/media-23257523)<br />[TC2 MAP](https://www.test.bbc.com/pashto/world/2016/09/160921_tc2_testmap1)<br />[Most Read](https://www.test.bbc.com/pashto/popular/read)<br />[On Demand Audio (Brand)](https://www.test.bbc.com/pashto/bbc_pashto_radio/programmes/p0340ysc)<br />[On Demand Audio (Episode)](https://www.test.bbc.com/pashto/bbc_pashto_radio/w3ct26m6)<br />[On Demand TV (Brand)](https://www.test.bbc.com/pashto/bbc_pashto_tv/tv_programmes/w13xttn4)<br />[On Demand TV (Episode)](https://www.test.bbc.com/pashto/bbc_pashto_tv/tv/w172xtq7x8660m1)<br />[PGL](https://www.test.bbc.com/pashto/23092924)<br />[STY](https://www.test.bbc.com/pashto/23289748)<br />[Topic](https://www.test.bbc.com/pashto/topics/cr50y57xj52t) | [Article](https://www.bbc.com/pashto/articles/c70970g2251o)<br />[Home](https://www.bbc.com/pashto)<br />[Live Radio](https://www.bbc.com/pashto/bbc_pashto_radio/liveradio)<br />[MAP](https://www.bbc.com/pashto/arts-and-literature-46787030)<br />[TC2 MAP](https://www.bbc.com/pashto/multimedia/2016/08/160827_gn_southafrica_female_farmer)<br />[Most Read](https://www.bbc.com/pashto/popular/read)<br />[On Demand Audio (Brand)](https://www.bbc.com/pashto/bbc_pashto_radio/programmes/p0340yr4)<br />[On Demand Audio (Episode)](https://www.bbc.com/pashto/bbc_pashto_radio/w3ct26m6)<br />[On Demand TV (Brand)](https://www.bbc.com/pashto/bbc_pashto_tv/tv_programmes/w13xttn4)<br />[On Demand TV (Episode)](https://www.bbc.com/pashto/bbc_pashto_tv/tv/w172xtq7x8660m1)<br />[PGL](https://www.bbc.com/pashto/arts-and-literature-50230813)<br />[STY](https://www.bbc.com/pashto/world-52873295)<br />[Topic](https://www.bbc.com/pashto/topics/cr50y57xj52t) |
Copy link
Contributor

Choose a reason for hiding this comment

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

Bit of pain but may also be worth updating these localhost:7080 references to localhost:7081 for topics routes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry just wanting clarity, would 7080 not work? Or is it because once we've fully migrated to NextJS the port will be 7081?

Copy link
Contributor

Choose a reason for hiding this comment

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

7081 will be the new port number for Topics pages after this change. Technically it'll still work on 7080 until we remove the old Express app code, but I think we should direct people to the new port now.

@@ -0,0 +1,81 @@
import { GetServerSideProps } from 'next';
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a test for this file as well? Similar pattern to the handleHomepageRoute and handleArticlePageRoute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants