8000 export menu fragments from /docsrc/pages/*.mjs · Issue #57 · magic/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
export menu fragments from /docsrc/pages/*.mjs #57
Open
@jaeh

Description

@jaeh

abstract:

pages can export menus, those get merged into the state.
this allows automagical menu generation.

questions:

? how will we determine page order
  1. using a 'priority' key in the exported menu object.
    no! not easy to change, every page has to be changed without overview over priorities
  2. using /docsrc/app.mjs to export an array with menu item priorities.
    no! separates menu order from menu
  3. using an array of strings within app.menu to determine order,
    then replace those identifiers with the menu exported from the page.
// /docsrc/pages/page1.mjs
export const state = {
    menu: [
      {
        text: 'page1 link text',
        to: '/page1/', // should be derived automagically
        items: [
          { text: 'subsection link text', to: '#subsection' },
        ],
      },
    ],
}

// /docsrc/pages/page2.mjs
export const state = {
  menu: {
    text: 'page2 link text',
    to: '/page2/', // should be derived automagically
  ],
}

// /docsrc/app.mjs
export const state = {
  menu: [
    { text: 'index page link', to: '/' },  
    ['/page2/', '/page1/', '...'],
  ],
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0