Questions about IsMenuCurrent function, tag names/keys, and theme contribution

Greetings!

I’m new user of Hugo and I utilized it to recreate my small company website that can be accessed at http://koris.hr (in Croatian only). I have three questions:

  1. How can I properly use IsMenuCurrent function to mark current page? Instructions from documentation at http://gohugo.io/extras/menus/ simply don’t work for me. I described problem in more detail here: http://discuss.gohugo.io/t/current-navigation/562/12?u=slaven_brumec
    I’m aware that this problem can be solved with javascript, however I think I need more elegant solution for a more civilized age. :slight_smile:
  2. I created a tag cloud in fat footer according to documentation here (point 4): http://gohugo.io/taxonomies/displaying/ However, I’d like to show not tag keys, but tag names. So, not bpmn and neither informacijski-sustavi, but BPMN and informacijski sustavi. How to do that?
  3. When displaying /tags page, with tag name as subtitle (e.g. http://koris.hr/tags/projekt/ ), it seems that Hugo capitalizes first letters in tag name. How to avoid this? Tag-title should be projekt, BPMN, and informacijski sustavi, and not capitalized to Projekt, Bpmn, and Informacijski Sustavi.

Finally, how can I contribute to Hugo with my theme? I think it’s a good theme, especially for folks that want to have blog/news as home page together with paging and tag-cloud. It’s fully responsive down to 320x480 px and quite simple in terms of text lines in CSS and number of partials.

Best regards and thanks for your answers!

BUMP! :slight_smile:

Anyone?

In the meantime, I’ve checked other themes. (I built mine mostly on casper example.) Regarding tags (questions 2 and 3), the only other theme that shows tag cloud is pixyll. However, it also shows tag keys instead of tag names.

Please, can someone help me? Those three problems are not such a big deal, and I like Hugo and if these problems are actually bugs, I can wait for them to be solved. I’d just like to know are they bugs or am I missing something.

  1. Currently you have to put the pages in a menu with a given parent and then something like this:
<nav class="sidebar-nav">
{{ $currentNode := . }}
{{ range .Site.Menus.main }}
<a class="sidebar-nav-item{{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }} active{{end}}" href="{{.URL}}">{{ .Name }}</a>
{{ end }}
</nav>

In this case I don’t have menu items for the children (the pages itself). There is an open PR (by me) called Section menus for the lazy bloggger that automate parts of this, but that isn’t merged.

In general I think you will get faster response if you do not fill your posts with several questions. Also check the docs.

The other two questions I believe have been partly discussed in other posts on this forum lately. There is a search in the upper right corner.

Hi!

I did have almost the exact code for menu as you have written, however as I said, it doesn’t work, even when exactly the yours. Try for yourself… but never mind. I solved the problem with very simple jQuery function. With the same function I also solved highlighting the blog menu item when some post is shown, and paging of blog which is also home page. So, Blog gets highlighted when on home page, when on paged blog/home page, and on post page. I’ll put my web-site on GitHub so that other folks can help themselves if encountering similar problem.

Regarding tag keys/names, I did not find any appropriate discussion. This solution, if it was even aimed at similar problem, simply doesn’t work. In this discussion, usage of tag keys was shown, not names. I haven’t found any other recent discussion, for current version of Hugo.

If I’m missing something, please let me know.

Best regards!

Well, this was a copy-and-paste from one of my WORKING sites …

Can you post a link, please? Do this site of yours has simple, one-level menu as mine or someting nested/drop-down?

Best regards!

No, it’s a private repo. It’s a one-level menu.

Post a link to your repo and I might have a look to se where you got it wrong.

I’ll post a link to my repo as soon as I learn how to put something into GitHub from terminal. Probably next week because of my other obligations. I have ever only put code on GitHub from an IDE, either from Windows/Visual Studio or Linux/Android Studio.

Of course, I’ll put a version of my site(s) that do not use my jQuery solutions, but pure Hugo solution with which I have a problem described in this discussion.

hi Bep and anyone else interested,

The above line does work, but only the ‘parent’ is specified in the front-matter of each page.

In Hugo 0.14 I experience both variables render false for pages, unless parent is defined for them.
{{if or ($currentNode.IsMenuCurrent “top” . ) ($currentNode.HasMenuCurrent “top” . ) }}

---
menu:
  main:
    parent: section_name
---

Jeroen

What above line?