-
Notifications
You must be signed in to change notification settings - Fork 132
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
allow menu front matter specific to a 'post'/Org subtree #19
Comments
I didn't follow that. Isn't the menu configuration done in Or did you mean that you'd like to specify the destination subdir for each subtree? Example:
|
I have a particular use-case in mind. For my courses, I maintian about 3-5 org source files, e.g., "course Details", "Labs", "Assignments". Then, for each assignment, I I maintian a subtree. So
Each of these should probably be a child menu item of the Unfortunately, the yaml and toml syntax for storing complex data objects like these hash tables/dictionaries is difficult to reproduce: menu:
main:
parent: assignments
weight: -100 I'm not quite sure even how this is supposed to be represeented in TOML. Anyway, it would be really nice to be able to automate some of this. And I think it's not just me who would like to be able to do that. Does this make more sense? Hugo menu docs are here: https://gohugo.io/extras/menus |
so, basically I'm confirming your example. |
menu:
main:
parent: assignments
weight: -100 Correct. But that menu hierarchy will be pretty much static once your site structure stabilizes. And then may be need adding/removing/moving the menu section once in a while. Is that right? My concern is that the
It would look something like this in TOML: [[menu.main]]
parent = "Assignments"
weight = -100
[[menu.main]]
parent = "Labs"
weight = 1
Definitely. Then we need to generate the whole |
Not necessarily, since it's possible to add the individual menu items in the frontmatter of each post. In fact ,this is how the hugo docs manage things: here's an example: full YAML for the above: ---
aliases:
- /doc/configuration/
lastmod: 2016-09-17
date: 2013-07-01
linktitle: Configuration
menu:
main:
parent: getting started
next: /overview/source-directory
toc: true
prev: /overview/usage
title: Configuring Hugo
weight: 40 |
It seems to me that Hugo itself hasn't really decided how it wants to manage menus and metadata in general. Org's data managmeent strategy is a little clearer, I think, and I would want to err on the side of keeping as much informaiton as possible in org itself, since the very fact of the exporter sort of assumes that the user is org-centric. At least I think so! |
Thanks for that example. I have tweaked the title slightly. So we will need to support these in the Org property drawer and then translate those to TOML/YAML. Right? |
Yes, thank you, I think that sounds right. |
I'm trying to generate a nested plist of values related to menus, that can then be passed off to the frontmatter generators (yaml and toml). Unfortunately I'm terrible at elisp, can can never tel lthe difference between a symbol and a vlaue, or a plist and an alist... THisi s what I have: (defun org-hugo--collect-menu-metadata (info)
"collect all the menu-related metadata and return a nested plist of the values
to be used by toml and yaml frontmatter creators."
(message "info: %s" info)
(let* ((menu-atts '(:hugo-menu-parent "parent" :hugo-menu-weight "weight"))
(menu-name (plist-get info :hugo-menu-name))
(atts-plist (cl-loop for att in (plist-get-keys menu-atts)
collect (plist-get menu-atts att)
collect (plist-get info att))))
(plist-put '() menu-name atts-plist))) But this generates I'm pretty sure this is a symbol/value clash but if you could either show me how to fix it or suggest a better method I'd be very grateful. |
If you have thoughts on this I'd love to hear them. I will try to investigate myself within the next 48 hours but might not get there, quite. |
Here's a rough explanation:
I cannot promise today, but I will get to this. Thanks! |
Hi Kaushal, you have been committing up a storm and I'm struggling to keep up! Thank you for all the new features. Any chance that this menu piece can work its way up your to-do list? getting this working would be really fantastic for me... |
I'm really busy this weekend. This is next on my list; will have a look on Monday. The feature additions were just to accommodate for basic support of tables and source blocks. With that, I might even publish a new post on my blog generated by |
This commit adds preliminary support for menu metadata in posts. It sort of works with YAML frontmatter but not with TOML. For #19
Found a TOML front matter example (for reference):
Example Hugo partial to make use of the above menu:
|
@titaniumbones From what I understand, the parent and identifier part of menu in your PR for menu support is optional, right? |
well, the parent definitely is, so it should be wrapped in an `if`
statement (I was gonna do that but maybe you're ahead of me now).
I had trouble getting hugo to accept the front matter without the
identifier statement, even though it looks like it ought to be
optional. In my tests (which I've been doing with a live site, not with
the test suite, oops) the site won't recompile without the identifier.
…On 07/17/2017 08:20 PM, Kaushal Modi wrote:
@titaniumbones <https:/titaniumbones> From what I
understand, the parent and identifier part of menu in your PR for menu
support is optional, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or mute the thread
<https:/notifications/unsubscribe-auth/AAWPNCj9ILrlJ2MrWKWU047bIbqdVyzsks5sO_o3gaJpZM4OLAH9>.
|
Closing this issue as menu front matter is now fully supported in both TOML and YAML. |
The YAML syntax for Hugo menu placement is:
menu:
main:
parent: articles
[etc]
Do we have a way to gneerate this kind of multilevel metadata? If not, we should have one...
The text was updated successfully, but these errors were encountered: