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

Enable menu entry creation within a content adapter #12507

Closed
jmooring opened this issue May 16, 2024 · 1 comment
Closed

Enable menu entry creation within a content adapter #12507

jmooring opened this issue May 16, 2024 · 1 comment

Comments

@jmooring
Copy link
Member

{{ range $firstLevel, $_ := site.Data }}
  {{ $page := dict
    "kind" "section"
    "path" $firstLevel
    "title" ($firstLevel | humanize)
    "menus" "main"
  }}
  {{ $.AddPage $page }}
  {{ range $secondLevel, $_ := . }}
    {{ $page := dict
      "kind" "page"
      "params" .
      "path" (path.Join $firstLevel $secondLevel)
      "title" ($secondLevel | humanize)
    }}
    {{ $.AddPage $page }}
  {{ end }}
{{ end }}

In the above I tried setting both "menu" and "menus" when adding the section page.

Example:

git clone --single-branch -b hugo-forum-topic-49842 https://github.com/jmooring/hugo-testing hugo-forum-topic-49842
cd hugo-forum-topic-49842
hugo server

I'm still a bit amazed at how powerful this is, and how easy it is to use.

@bep bep self-assigned this May 17, 2024
@bep bep added this to the v0.126.2 milestone May 17, 2024
@bep bep removed the Proposal label May 17, 2024
@bep bep modified the milestones: v0.126.2, v0.127.0 May 29, 2024
bep added a commit that referenced this issue May 29, 2024
bep added a commit that referenced this issue May 29, 2024
bep added a commit that referenced this issue May 29, 2024
bep added a commit that referenced this issue May 29, 2024
bep added a commit that referenced this issue May 29, 2024
bep added a commit that referenced this issue May 30, 2024
bep added a commit to bep/hugo that referenced this issue May 30, 2024
bep added a commit to bep/hugo that referenced this issue May 30, 2024
@bep bep closed this as completed in 245928a May 30, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants