-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Re-document how to use a custom order with explorer #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @aubertc I'm still successfully using the code I created to set a custom order (if you look in the src folder on the main branch of my 3d artists handbook, you can see it in action). I don't see why it wouldn't work anymore, as it's just a simple loop that takes a list to determine the new order in which the outliner structure is created. |
But I'm not on the newest quartz version yet, so that might be why. |
You seem to be on |
The code logic probably can stay as is and just needs to be adapted to the new variable names (or element item name) or structure that changed. This probably is doable without too much effort or know how. |
I have been trying out an alternative, for my 3d artist handbook at least (astro's starlight framework with an obsidian plugin), so I currently won't be updating or touching any of the code in my quartz project for the time being. |
Thanks for getting back to me @sidney-eliot , I fully understand. I will try again to re-document this feature, hopefully with more success this time. @saberzero1 do you have any idea / guidance on what changed that caused this feature not to work anymore? The problem that I am having right now is that the sortFn function, declared as
cannot seem to be able to access the const nameOrderMap: Record<string, number> = {
"poetry-folder": 100,
"essay-folder": 200,
"research-paper-file": 201,
"dinosaur-fossils-file": 300,
"other-folder": 400,
}
|
The sort function (and filter function and map function for that matter) are stringified and passed to the |
Thanks for the indication @saberzero1 but I'm sorry, I still can't make it work… My // quartz.layout.ts
import { Options } from "./quartz/components/Explorer"
export const sortFn: Options["sortFn"] = (a, b) => {
const nameOrderMap: Record<string, number> = {
"docs/index.md": 1,
"docs/about/index.md": 2,
}
return (nameOrderMap[a.data.filePath] || 0)- (nameOrderMap[b.data.filePath] || 0)
} But if I try to "split" this function so that the // quartz.layout.ts
import { Options } from "./quartz/components/Explorer"
import { nameOrderMap } from "./content/web-order"
export const sortFn: Options["sortFn"] = (a, b) => {
return (nameOrderMap[a.data.filePath] || 0)- (nameOrderMap[b.data.filePath] || 0)
} // quartz/components/scripts/explorer.inline.ts
import { nameOrderMap } from "../../../content/web-order" // content/web-order
export const nameOrderMap: Record<string, number> = {
"docs/index.md": 1,
"docs/about/index.md": 2,
} |
Is there any particular reason why you have the Do you have any errors logged to the browser console? |
The
Nothing relevant, no. And the explorer is empty, so clearly something is not going through. |
Do you have a public repository, so I can see what your exact setup is? |
The version that is currently deployed (that works using a custom order and quartz v.4.0) is at https://github.com/princomp/princomp.github.io/tree/quartz, where the relevant files are https://github.com/princomp/princomp.github.io/blob/quartz/sortFn.ts The version I am currently working on is hosted at https://github.com/princomp/princomp.github.io/tree/quartz-update (there are only 2 relevant commits, all the history is forked from quartz repo otherwise). Thanks a lot for looking into it. |
The version you're working on has no |
Yes, it is built separately (it's a long story ;-) told in part at https://princomp.github.io/docs/about/dev_guide#deploying-locally-the-website ) |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
It used to be the case that an example
nameOrderMap
record was given as an example on how to impose a non-alphabetical order on the elements of the explorer. This example was deleted with this commit: e59181c#diff-f9be51d330ad746884c756fb97a0726708199f0bb733d5dfbc8a4b110b11399bL266-L319Describe the solution you'd like
It would be nice to have documented how a custom order can be developed for the explorer, like there was before (e.g. how to have "Poetry Folder" displayed before "Essay Folder" in the explorer)
Describe alternatives you've considered
I have tried to adapt the example myself to the current version of quartz but was unsuccessful. I can share my attempt in more details if that is useful.
Additional context
This "custom order" explorer is used on the website https://princomp.github.io/ that requires a very particular order in its content (the lectures are not numbered, but should be followed in a particular order). I even have an "order" file that I used to automatically create a
web-order.ts
file that I then import to have the new order seamlessly integrated.The text was updated successfully, but these errors were encountered: