Skip to content

Commit

Permalink
add telegram link
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviomoceri committed Oct 29, 2024
1 parent ba050dc commit 9d56cb0
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions quartz/quartz.layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,39 @@ export const sharedPageComponents: SharedLayout = {
links: {
Synonym: "https://synonym.to",
GitHub: "https://github.com/pubky/pubky-knowledge-base",
Discord: "https://discord.com/invite/DxTBJXvJxn",
Telegram: "https://t.me/pubkychat",
},
}),
}

const explorer = Component.Explorer({
sortFn: (a, b) => {
// Helper function to prioritise "Introduction" and "ELI5"
const priority = (name : string) => {
if (name === "Introduction") return -2; // Highest priority
if (name === "ELI5") return -1; // Second highest priority
return 0; // No priority
};
const priority = (name: string) => {
if (name === "Introduction") return -2 // Highest priority
if (name === "ELI5") return -1 // Second highest priority
return 0 // No priority
}

// Check if both are files or directories
const aIsFile = typeof a.file !== null;
const bIsFile = typeof b.file !== null;
const aIsFile = typeof a.file !== null
const bIsFile = typeof b.file !== null

// Prioritize specific filenames first
const aPriority = priority(a.name);
const bPriority = priority(b.name);
const aPriority = priority(a.name)
const bPriority = priority(b.name)

// If either has a priority, sort based on that
if (aPriority !== bPriority) return aPriority - bPriority;
if (aPriority !== bPriority) return aPriority - bPriority

// If one is a file and the other is a directory, sort files first
if (aIsFile && !bIsFile) return -1; // a is a file, b is a directory
if (!aIsFile && bIsFile) return 1; // a is a directory, b is a file
if (aIsFile && !bIsFile) return -1 // a is a file, b is a directory
if (!aIsFile && bIsFile) return 1 // a is a directory, b is a file

// If both are either files or directories, sort alphabetically
return a.name.localeCompare(b.name);
}
});

return a.name.localeCompare(b.name)
},
})

// components for pages that display a single page (e.g. a single note)
export const defaultContentPageLayout: PageLayout = {
Expand Down

0 comments on commit 9d56cb0

Please sign in to comment.