Skip to content

Commit

Permalink
Updated dynamic navigation bar and other minor updates
Browse files Browse the repository at this point in the history
Updated the navigation bar code to not use the customJS plugin as it was causing errors to be displayed when the navbar is loaded on launch of Obsidian and occasionally on mobile devices. The README has been updated to reflect this change.
  • Loading branch information
SoRobby committed Oct 29, 2023
1 parent bb9f1ab commit 472c911
Show file tree
Hide file tree
Showing 55 changed files with 17,684 additions and 9,540 deletions.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,41 @@ The links displayed in the navigation bar are set by a combination of a page's t

````
```dataviewjs
const {Navbar} = customJS;
await Navbar.createNavbar(app, dv);
let navbar = [];
let loadingMessage = dv.el("span", "**Loading navigation...**", {attr: {style: "font-size:13px; color:gray"}});
let allPages = dv.pages("#dashboard").sort(page => page.file.folder, "asc");
let filteredPages = allPages.filter(p =>
p.file.tags.values.includes("#dashboard") && p?.include_in_navbar == true
);
for(let page of filteredPages){
let navItem = '';
let navName = 'Untitled';
let navLink = '';
if(page.navbar_name === undefined){
navName = page.file.name;
} else {
navName = page.navbar_name;
}
navLink = page.file.path;
// Format the nav item link
if(dv.current().file.path === page.file.path){
navItem = `**[[${navLink}|${navName}]]**`
} else {
navItem = `[[${navLink}|${navName}]]`
}
navbar.push(navItem)
}
dv.paragraph(navbar.join(' | '))
if(filteredPages.values.length > 0){
loadingMessage.remove();
}
```
````

Expand Down
1 change: 0 additions & 1 deletion Vault/.obsidian/community-plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"buttons",
"obsidian-tasks-plugin",
"obsidian-style-settings",
"homepage",
"obsidian-book-search-plugin",
"templater-obsidian",
"obsidian-image-toolkit",
Expand Down
3 changes: 2 additions & 1 deletion Vault/.obsidian/core-plugins-migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false
"sync": false,
"properties": false
}
6,428 changes: 6,309 additions & 119 deletions Vault/.obsidian/plugins/customjs/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Vault/.obsidian/plugins/customjs/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "customjs",
"name": "CustomJS",
"version": "1.0.13",
"version": "1.0.17",
"minAppVersion": "0.9.12",
"description": "This plugin allows for the loading and reuse of custom JS inside your vault.",
"description": "This plugin allows for the loading and reuse of custom javascript files inside your vault.",
"author": "Sam Lewis",
"authorUrl": "https://github.com/samlewis0602",
"isDesktopOnly": false
Expand Down
Loading

0 comments on commit 472c911

Please sign in to comment.