Skip to content
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

export menu fragments from /docsrc/pages/*.mjs #57

Open
jaeh opened this issue Dec 7, 2019 · 1 comment
Open

export menu fragments from /docsrc/pages/*.mjs #57

jaeh opened this issue Dec 7, 2019 · 1 comment
Assignees

Comments

@jaeh
Copy link
Member

jaeh commented Dec 7, 2019

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/', '...'],
  ],
}
@jaeh
Copy link
Member Author

jaeh commented Jan 3, 2020

this currently is not possible, state preparation has to change.
first, the state has to be built once for all pages before they get transpiled,

@jaeh jaeh self-assigned this Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant