lsst-epo / rubin-obs-client

Client for the Rubin Observatory operational site
https://rubinobservatory.org
0 stars 0 forks source link

Tag links in News articles 404 #8

Closed blnkt closed 2 years ago

blnkt commented 2 years ago

Expected Behavior

Tag should link to news search results page with same results as you would find if you manually searched the tag term in the sort/filter/search bar.

Actual Behavior

404 page not found.

Steps to Reproduce the Problem

  1. Go to Collision of Neutron Stars Caught in the Act
  2. Click on neutron star link
  3. Redirects to https://staging.rubinobs.org/undefined?search=neutron-star (note undefined value) Screen Shot 2021-12-16 at 9 06 13 AM

For comparison:

  1. Go to News page and search neutron star
  2. Redirects to https://staging.rubinobs.org/news?search=neutron+star Screen Shot 2021-12-16 at 9 07 49 AM
jen-castiron commented 2 years ago

Hey @blnkt , it looks like this one is an API issue. To get the links to work, "News" needs to be set as a root page in craft: https://rubin-obs-api-int-2eici5myiq-uc.a.run.app/admin/globals/default/rootPageInformation The front-end is looking for "News" in that list of root pages, and then getting the news uri from that data.

Where the news page is getting breadcrumb data: https://github.com/lsst-epo/rubin-obs-client/blob/master/components/templates/NewsPage/index.js#L45

The useCustomBreadcrumbs function, which looks for root pages: https://github.com/lsst-epo/rubin-obs-client/blob/master/lib/utils.js#L87-L93

There's a few places in the code where this hook is looking for root values, and they're not defined in Craft either:

Is there any reason not to add these pages to the global root page information?

blnkt commented 2 years ago

No that sounds like a fine solution, makes sense now that you've explained it. I think that functionality was never very clear to us so our Content Editors probably just didn't know to make the change in that Globals section. I'll give it a go and watch the magic happen. And if it works as you say I'll close this issue.

blnkt commented 2 years ago

works just as you say. Thank you much.