Skip to content

Best practices guide for editing Hugo menus in CloudCannon聽#72

Description

@rycoll

This will need to wait for an upcoming improvements on object inputs 馃憖 but it would be good to have a guide on how to best manage Hugo menus in CloudCannon.

I'll moved over some starter content from Notion below 馃憞


We can use our Input Configuration and Structures.

After setting some configuration for menus in your Hugo config file, it then depends how you want to choose menus in each file.

Simple Menu

Here鈥檚 an example for being able to choose what menus a file appears in:

/content/about.md

---
menu:
  - footer
  - main
---

Then the _inputs configuration:

/cloudcannon.config.yml

_inputs:
  menu:
    type: multiselect
    options:
      values:
        main: Heading menu
        footer: Footer
        aside: Right sidebar

That gives you this input:

Untitled

Advanced menu:

This is the one with weight and parent keys:

/content/about.md

---
menu:
  main:
    weight: 4
  footer:
    weight: 4
    parent: main
---

Once we have released support for adding keys to an object, you'll be able to configure something more flexible using the allowed_keys config:

/cloudcannon.config.yml

_inputs:
  menu:
    type: object
    options:
      allowed_keys:
        - main
        - footer
        - aside
  menu.*:
    type: object
      options:
        structures:
          values:
            - label: Menu Item
              value:
                weight:
                parent:
  weight:
    type: number
  parent:
    type: select
    options:
      values:
        main: Heading menu
        footer: Footer
        aside: Right sidebar

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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