| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 | export default {
  // Returns an array with the slotted previous and next links, prepared
  // for inclusion in a page's navigation bar. Include with other links
  // in the nav bar and then join them all as a unit list, for example.
  contentDependencies: ['generateNextLink', 'generatePreviousLink'],
  extraDependencies: ['html', 'language'],
  relations: (relation) => ({
    previousLink:
      relation('generatePreviousLink'),
    nextLink:
      relation('generateNextLink'),
  }),
  slots: {
    previousLink: {
      type: 'html',
      mutable: true,
    },
    nextLink: {
      type: 'html',
      mutable: true,
    },
    id: {
      type: 'boolean',
      default: true,
    },
  },
  generate(relations, slots, {html, language}) {
    const previousNext = [];
    relations.previousLink.setSlots({
      link: slots.previousLink,
      id: slots.id,
    });
    relations.nextLink.setSlots({
      link: slots.nextLink,
      id: slots.id,
    });
    if (!html.isBlank(slots.previousLink)) {
      previousNext.push(relations.previousLink);
    }
    if (!html.isBlank(slots.nextLink)) {
      previousNext.push(relations.nextLink);
    }
    return previousNext;
  },
};
 |