Color mode

Backlinks

Backlink list rendering for articles: shows which published notes link to the current note.

日本語

Overview

backlinksPlugin() appends a footer list of incoming links to the article.footer body slot. getPublishedBacklinks() resolves the incoming links of a note from the content manifest, keeps only publicly discoverable notes, and returns them sorted in manifest order.

Without incoming links (or when none of them are published), the component renders nothing.

Usage

ts
import { defineConfig } from "@riebeckite/core";
import { backlinksPlugin } from "@riebeckite/plugin-backlinks";
 
export default defineConfig({
  // ...
  plugins: [backlinksPlugin()],
});

backlinksPlugin() adds backlinks for every public entry with published incoming links and bundles style.css into the app stylesheet. Render the article.footer body slot in the article layout to display the list.

Custom placement

tsx
import Backlinks, { getPublishedBacklinks } from "@riebeckite/plugin-backlinks";
import { config } from "../config";
import { content } from "../content";
import { getArticleTitle } from "../lib/article-title";
 
const manifest = await content.getManifest();
const backlinks = getPublishedBacklinks({
  manifest,
  config,
  slug,
  resolveTitle: getArticleTitle,
});
 
return (
  <Article
    footerContent={<Backlinks backlinks={backlinks} />}
  />
);

Component

Backlinks({ backlinks }) renders a <footer class="article-backlinks rr-backlinks"> with an eyebrow label and a list of links to each backlink's resolved permalink.

Exports

  • backlinksPlugin() — plugin factory
  • Backlinks — list component (default export of components/backlinks.tsx)
  • getPublishedBacklinks({ manifest, config, slug, resolveTitle }) — resolves published backlinks for a slug
  • Type: ArticleBacklink ({ slug, permalink, title })

See also

History

1 changesCollapseExpand
1 + <!-- Generated from packages/plugins/backlinks/README.md. Do not edit this page directly; edit the package README and run `pnpm docs:sync`. -->
2 +
3 + # Backlinks
4 +
5 + Backlink list rendering for articles: shows which published notes link to the
6 + current note.
7 +
8 + [日本語](./backlinks.md)
9 +
10 + ## Overview
11 +
12 + `backlinksPlugin()` appends a footer list of incoming links to the
13 + `article.footer` body slot. `getPublishedBacklinks()` resolves the incoming
14 + links of a note from the content manifest, keeps only publicly discoverable
15 + notes, and returns them sorted in manifest order.
16 +
17 + Without incoming links (or when none of them are published), the component
18 + renders nothing.
19 +
20 + ## Usage
21 +
22 + ```ts
23 + import { defineConfig } from "@riebeckite/core";
24 + import { backlinksPlugin } from "@riebeckite/plugin-backlinks";
25 +
26 + export default defineConfig({
27 + // ...
28 + plugins: [backlinksPlugin()],
29 + });
30 + ```
31 +
32 + `backlinksPlugin()` adds backlinks for every public entry with published
33 + incoming links and bundles `style.css` into the app stylesheet. Render the
34 + `article.footer` body slot in the article layout to display the list.
35 +
36 + ### Custom placement
37 +
38 + ```tsx
39 + import Backlinks, { getPublishedBacklinks } from "@riebeckite/plugin-backlinks";
40 + import { config } from "../config";
41 + import { content } from "../content";
42 + import { getArticleTitle } from "../lib/article-title";
43 +
44 + const manifest = await content.getManifest();
45 + const backlinks = getPublishedBacklinks({
46 + manifest,
47 + config,
48 + slug,
49 + resolveTitle: getArticleTitle,
50 + });
51 +
52 + return (
53 + <Article
54 + footerContent={<Backlinks backlinks={backlinks} />}
55 + />
56 + );
57 + ```
58 +
59 + ## Component
60 +
61 + `Backlinks({ backlinks })` renders a `<footer class="article-backlinks rr-backlinks">` with
62 + an eyebrow label and a list of links to each backlink's resolved `permalink`.
63 +
64 + ## Exports
65 +
66 + - `backlinksPlugin()` — plugin factory
67 + - `Backlinks` — list component (default export of `components/backlinks.tsx`)
68 + - `getPublishedBacklinks({ manifest, config, slug, resolveTitle })` — resolves
69 + published backlinks for a slug
70 + - Type: `ArticleBacklink` (`{ slug, permalink, title }`)
71 +
72 + ## See also
73 +
74 + - [Plugin guide](../reference/plugin-api.en.md)
75 + - [`@riebeckite/plugin-local-graph`](./local-graph.en.md)
76 + - [`@riebeckite/plugin-garden-explorer`](./garden-explorer.en.md)
77 +