astro-better-docs-sidebar 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Sidebar.astro +19 -16
  2. package/package.json +1 -1
package/Sidebar.astro CHANGED
@@ -52,27 +52,30 @@ function buildTree(pages: any[]) {
52
52
 
53
53
  if (part === 'index') {
54
54
  const effective: FolderBehavior = pageFolderBehavior || folderBehavior;
55
- const href = `${basePath}/${slug.replace(/\/index$/, "")}`.replace(/\/+/g, '/').replace(/\/$/, "");
56
55
 
57
56
  current.title = label || dataTitle || current.title;
58
57
  if (order !== undefined) current.order = order;
59
58
 
60
- if (effective === 'page') {
61
- current.href = href;
62
- } else if (effective === 'overview') {
63
- // inject a synthetic first child that links to the index page
64
- current.children['__sidebar_overview__'] = {
65
- name: '__sidebar_overview__',
66
- title: overviewLabel,
67
- href,
68
- children: {},
69
- sortedChildren: [],
70
- isOpen: false,
71
- isActive: false,
72
- order: -Infinity,
73
- };
59
+ // route: false pages still contribute title/order but produce no link
60
+ if (page.data?.route !== false) {
61
+ const href = `${basePath}/${slug.replace(/\/index$/, "")}`.replace(/\/+/g, '/').replace(/\/$/, "");
62
+ if (effective === 'page') {
63
+ current.href = href;
64
+ } else if (effective === 'overview') {
65
+ // inject a synthetic first child that links to the index page
66
+ current.children['__sidebar_overview__'] = {
67
+ name: '__sidebar_overview__',
68
+ title: overviewLabel,
69
+ href,
70
+ children: {},
71
+ sortedChildren: [],
72
+ isOpen: false,
73
+ isActive: false,
74
+ order: -Infinity,
75
+ };
76
+ }
77
+ // 'unclickable': no href set, no overview child
74
78
  }
75
- // 'unclickable': no href set, no overview child
76
79
  break;
77
80
  }
78
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-better-docs-sidebar",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./Sidebar.astro": "./Sidebar.astro",