-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added support for tags #196
Conversation
Display tags list when clicking on tag
I am very interested by this feature. Can I help? |
There's a couple of things if you would like to contribute.
I notice @pdelaby added tags to the sample site however when this MR was opened the netlify build was not working. Could you rebase this against master to kick a fresh build? It will render an entirely new copy of the example site along with the changes. |
@matalo33 Thanks. I currently run a rebased version of @pdelaby's work on a private project and it works fine (except that I have to restart the server when I touch to taxonomies, but I think it's a limitation from hugo itself). Here are some screenshots showing how it looks: After clicking on a tag, it looks like this: As far as I'm concerned, I think it looks good overall. If I had anything to say, I would say that the taxonomy page (third screenshot) is not very good looking, but I'm not sure how to improve it. At very least, punctuation is incorrect in english and should be fixed. I don't have much to say on the implementation itself. It looks correctly written to me however I don't contribute a lot to Hugo themes. There are obvious typos in the English docs, I'll mention the ones I find. Yet, the french version looks perfect. |
exampleSite/content/cont/tags.en.md
Outdated
tags: ["documentation", "tutorial"] | ||
--- | ||
|
||
*Learn theme* support one default taxonomy of gohugo : the *tag* feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no space before colons in english.
exampleSite/content/cont/tags.en.md
Outdated
|
||
## Configuration | ||
|
||
Just add tags to any page : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no space before colons in english.
exampleSite/content/cont/tags.en.md
Outdated
## Behavior | ||
|
||
|
||
The tags are displayed at the top of the page, in the order wich they are enterted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- wich
+ which
- enterted
+ entered
Not even sure the use of the verb enter
is correct here. Maybe “in order of insertion” is slightly better?
layouts/partials/header.html
Outdated
<h1>{{.Title}}</h1> | ||
<h1> | ||
{{ if eq .Kind "taxonomy" }} | ||
{{.Kind}} : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English doesn't have spaces before colons. Not sure how to handle this 🤔 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found no other usage of colons in the theme, except for the title <title>{{ .Title }} :: {{ .Site.Title }}</title>
. Maybe we can use double quotes, or some kind of emphasis in order to get rid of the colon?
A good solution could be to use the lang
attribute of the html
tag, and CSS. Wrapping the colon in a span <span class="colon">:</span>
could allow to use something like:
html[lang="fr"] .colon{
padding-left:0.2em;
}
But even with the fr-fr
language code in config.toml
, I did not found a way to change the lang
attribute in html (which is always en
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say ::
is good enough. Pretty sure I've already seen it somewhere. @matalo33 what do you think?
layouts/partials/tags.html
Outdated
@@ -0,0 +1,7 @@ | |||
<div class="tags"> | |||
{{ if .Params.tags }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should wrap the div
so that we don't even display the div when there are no tags.
layouts/partials/tags.html
Outdated
<div class="tags"> | ||
{{ if .Params.tags }} | ||
{{range .Params.tags}} | ||
<a class="tag-link" href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }} </a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless trailing space?
Thanks for the help @gilbsgilbs :-) Sorry for the english typos. We are using this feature on our projects (with a forked repository for now) for 4 months now, and found no bugs yet. Some insights about it :
During edition ( |
It's quite easy to reproduce:
As I said, I'm pretty sure hugo is at fault here.
|
Works very well. I really like the styling of the nametag element on the content pages. I agree that the taxonomy page could use some more work. I am not a designer though :) Some sample tag pages from other themes: @pdelaby Please could you address the pull request feedback already provided?
Some of the examples above include this feature, however we can track this as a future improvement to get the feature released sooner than later. |
Thanks for everything @pdelaby. If you could just get this branch rebased and ready for merge I'm happy to proceed. |
Thanks :-) |
My bad, actually I could do this myself! Thanks again |
I love your theme, so I added the support for one of the default taxonomy in GoHugo : tags.
I also added documentation in the exampleSite, and the theme variants.
I only doubt about the CSS, if anyone have a better idea don't hesitate :-)