Skip to content

Commit

Permalink
Link to article-url if context fetched is invisible.
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Nov 19, 2024
1 parent 65dae62 commit b5a02f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/api/embedsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,14 @@ const contentLinkMeta: Fetch<ContentLinkMetaData> = async ({ embedData, context,
let path = `${host}/${context.language}/${contentType}/${embedData.contentId}`;
let url = `${host}/${context.language}/${contentType}/${embedData.contentId}`;
const nodes = await queryNodes(
{ contentURI, language: context.language, includeContexts: true, filterProgrammes: true },
{ contentURI, language: context.language, includeContexts: true, filterProgrammes: true, isVisible: true },
context,
);
const node = nodes.find((n) => !!n.path);
const ctx = opts.subject ? node?.contexts?.find((c) => c.rootId === opts.subject) : node?.contexts?.[0];
const ctx = opts.subject ? node?.contexts?.find((c) => c.rootId === opts.subject) : node?.context;
if (!ctx?.isVisible) {
return { path };
}
const nodePath = ctx?.path ?? node?.path;
const nodeUrl = ctx?.url ?? node?.url;

Expand Down

0 comments on commit b5a02f5

Please sign in to comment.