Giter Site home page Giter Site logo

Menu Ordering about docus HOT 8 CLOSED

nuxt-themes avatar nuxt-themes commented on May 10, 2024
Menu Ordering

from docus.

Comments (8)

Atinux avatar Atinux commented on May 10, 2024

This is indeed something to consider, I thought we had categoriesPosition.

I think the easiest way would be to have a sidebar option in settings.json, what do you think @benjamincanac ?

from docus.

pi0 avatar pi0 commented on May 10, 2024

I would also like to know your ideas regarding naming convention for ordering. It has advantage that visually ordering is visible in file-explorer and it should be also easy to implement:

  • Always sort by file name
  • Remove \d+\. prefix for generating title and url

Benefit of sidebar options we have full control over menu rendering and can also hide some pages that only internally need reference

from docus.

Atinux avatar Atinux commented on May 10, 2024

I like the idea of naming convention but I also believe that using prefix with 1.my-file.md will lead to same issues:

  • Adding a file in-between will lead to renaming a bunch of files
  • We need to support inside content a way to rename the slug to remove the prefix, might be possible with a hook

Regarding hiding some pages, I worked on a draft option directly that works well, we could also support it with filename too: 02.not-done.draft.md for example.

I would vote for convention over configuration for sure, only thing to know is how hard would it be to implement 😀

from docus.

pi0 avatar pi0 commented on May 10, 2024

Adding a file in-between will lead to renaming a bunch of files

Well this is also implied by having position prop since adding a new file requires updating all positions for disired orderer

We need to support inside content a way to rename the slug to remove the prefix, might be possible with a hook

Yeah either a hook or even rumtime method (like normalizeSlug) might do the trick to reemove prefix. Only need a way to ensure content are sorted since i think content module currently does not do this

Regarding hiding some pages, I worked on a draft option directly that works well, we could also support it with filename too: 02.not-done.draft.md for example.

Nice idea for draft flags! Reminder maybe we should consider _* ignore pattern?

from docus.

Atinux avatar Atinux commented on May 10, 2024

I thought about the _* pattern but then it may be more confusing with the prefix

from docus.

Atinux avatar Atinux commented on May 10, 2024

This could be nice to explore in order to remove the position attribute for pages, do you mind taking a look at how it is achievable @farnabaz ?

from docus.

farnabaz avatar farnabaz commented on May 10, 2024

I looked at Docus and Content module, the implementation of both draft and order convention seems straightforward.
Documents can modify using content:file:beforeInsert hook. Thedraft and position can extract from file name and slug should update.

For now Docus use document path for fetch them on _.vue.

// https://github.com/nuxtlabs/docus/blob/main/theme/pages/_.vue#L44-L45
 const path = `/${app.i18n.locale}/${params.pathMatch || 'index'}`
 const [document] = await $content({ deep: true }).where({ path }).fetch()

With this changes fetching document with path will be hard work and dir + slug should be used.

const dir = `/${app.i18n.locale}`
const slug = params.pathMatch || 'index'
const [document] = await $content({ deep: true }).where({ dir, slug }).fetch()

from docus.

Atinux avatar Atinux commented on May 10, 2024

Using dir + slug looks good to me :)

from docus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.