Skip to content

feat(signposting): add signposting service#873

Merged
futa-ikeda merged 1 commit intoCenterForOpenScience:feature/fair-signpostingfrom
futa-ikeda:feature/signposting-service
Feb 5, 2026
Merged

feat(signposting): add signposting service#873
futa-ikeda merged 1 commit intoCenterForOpenScience:feature/fair-signpostingfrom
futa-ikeda:feature/signposting-service

Conversation

@futa-ikeda
Copy link
Contributor

  • Ticket: [ENG-10161]
  • Feature flag: n/a

Purpose

  • Add a new service to handle adding signposting links for a given guid overview page

Summary of Changes

  • Add a new signposting service
  • Add tests for said service

Note: This service by itself won't do anything. In the page that needs signposting, one should call SignpostingService.addSignposting(guid); to add signposting links to the link response header and <link> tags to the <head>

Screenshot(s)

  • When running the app in server-side rendering mode using npm run serve:ssr:osf:
    • Use curl -I <url> to get the response headers. Note the presence of the link header here
image
  • Use curl <url> to get the returned HTML doc (in this case saving it to a text file for illustrative purposes). Not the presence of <link rel="linkset"> here
image

Side Effects

QA Notes

@futa-ikeda futa-ikeda requested a review from nsemets February 3, 2026 20:01
@futa-ikeda futa-ikeda force-pushed the feature/signposting-service branch from 5feb57e to 33db68c Compare February 5, 2026 02:01
@futa-ikeda
Copy link
Contributor Author

Ok, I have moved the constants LINKSET_TYPE and LINKSET_JSON_TYPE to /models/signposting.model.ts, and have implemented the simplified version you have suggested code using Renderer2.

I still don't like how the test is written, particularly the repetitive lines like expect(mockRenderer.setAttribute).toHaveBeenNthCalledWith(X, ...), as I think it would be best to just be able to do something like

expect(mockRenderer.appendChild).toHaveBeenNthCalledWith(1, {
  type: 'application/linkset',
  rel: 'linkset',
  href: 'https://staging3.osf.io/metadata/abcde/?format=linkset%2Bjson'
});

Not sure if you have any advise there, or if you think the test is fine as it is.

@futa-ikeda futa-ikeda force-pushed the feature/signposting-service branch from 33db68c to ef162fe Compare February 5, 2026 14:49
@futa-ikeda futa-ikeda merged commit 01f5a10 into CenterForOpenScience:feature/fair-signposting Feb 5, 2026
3 checks passed
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.

2 participants