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

Tags not hyphenated consistently #65

Closed
saurabh-sm opened this issue Jun 4, 2024 · 17 comments
Closed

Tags not hyphenated consistently #65

saurabh-sm opened this issue Jun 4, 2024 · 17 comments

Comments

@saurabh-sm
Copy link

saurabh-sm commented Jun 4, 2024

I noticed that when a front matter has:

tags = ['sliding-window']

it is displayed as Sliding-Window in the menu section.

But front matter containing

tags = ['binary-search']

is displayed as Binary Search in the menu section.

Clicking on both these pills goes to their expected URL of localhost:1313/tags/sliding-window and localhost:1313/tags/binary-search.


Edit

I can see that every tag except Binary Search has a hyphen between words.

Additionally, hyphenation between words is present in tags and categories but not authors. I think there shouldn't be hyphens between words in tags and categories (as is the case with authors), i.e., Binary Search is being displayed correctly but Sliding-Window is not.

@willfaught
Copy link
Owner

Did you define the title of the binary-search page in content/tags/binary-search/_index.md to be "Binary Search"?

@saurabh-sm
Copy link
Author

No I did not. The content/tags/ directory looks like:

.
├── _index.md
└── sections
    └── _index.md

Where the first _index.md has:

---
description: "Browse by tag."
layout: "paige/cloud"
title: "Tags"
---

and sections/_index.md has:

---
description: "Demonstration of a tag."
title: "Sections"
---

@willfaught
Copy link
Owner

By menu section, do you mean the home page or a section list page, or something else?

@willfaught
Copy link
Owner

Have you configured categories, tags, and authors as taxonomies in hugo.toml?

@saurabh-sm
Copy link
Author

saurabh-sm commented Jun 4, 2024

By menu section, do you mean the home page or a section list page, or something else?

On the Paige website, "Content" would be a menu section, "Layouts" would be another menu sections, etc.

Have you configured categories, tags, and authors as taxonomies in hugo.toml?

Yes I have - at the bottom of hugo.toml, I have:

[taxonomies]
author = "authors"
category = "categories"
tag = "tags"

@willfaught
Copy link
Owner

On the Paige website, "Content" would be a menu section, "Layouts" would be another menu sections, etc.

I don't understand what you mean by a page having a sliding-window tag displaying that tag as Sliding-Window in the menu. Page tags aren't displayed in the menu.

@saurabh-sm
Copy link
Author

saurabh-sm commented Jun 4, 2024

I don't understand what you mean by a page having a sliding-window tag displaying that tag as Sliding-Window in the menu. Page tags aren't displayed in the menu.

The content menu section is configured in a way that displays the title and description of every page in content. So there's a title like "Markdown Syntax Guide" and its description "Sample article showcasing basic Markdown syntax and formatting for HTML elements."

If this configuration is changed from:

---
description: "Demonstrations of Paige content."
title: "Content"
---

to

+++
description: "Demonstrations of Paige content."
title: "Content"
[paige]
style = """
#paige-authors,
#paige-keywords,
#paige-reading-time,
#paige-toc,
#paige-credit,
.paige-credit,
.paige-authors {
    display: block;
}
.paige-keywords {
    display: block;
}
"""
+++

the authors and keywords (tags and categories) will also be displayed for "Markdown Syntax Guide" and other pages below their description.

So tags on single pages would be displayed in the content menu section.

@willfaught
Copy link
Owner

willfaught commented Jun 4, 2024

OK, so you're talking about the tags displayed below the title and description in the home and section pages.

In Hugo parlance, content/_index.md is the home page, and content/sections/_index.md (any content/**/_index.md file excluding content/_index.md) is a section page. See https://gohugo.io/getting-started/glossary/#section-page.

In Hugo parlance, in some contexts, "section page" and "list page" can be interchangeable. See https://gohugo.io/getting-started/glossary/#list-page.

In Paige parlance, the menu is the optional horizontal list of links at the top of the page like Home, Content, Layouts, Search, etc.


Paige doesn't control the capitalization of taxonomy terms like tag values. It looks like Hugo capitalizes words in taxonomy terms automatically. If you want to customize what's displayed, you can set the title in content/$taxonomy/$term/_index.md. Give "sliding-window" and get "Sliding-Window", "binary search" and "Binary Search", "foo_bar" and "Foo_bar" (apparently it considers x_y one word). Note that if you give "binary search" or "Binary Search", it will still map to binary-search.

I suspect you have "binary search" or "Binary Search" in your front matter.

@saurabh-sm
Copy link
Author

saurabh-sm commented Jun 4, 2024

OK, so you're talking about the tags displayed below the title and description in the home and section pages.

In Hugo parlance, content/_index.md is the home page, and content/sections/_index.md (any content/**/_index.md file excluding content/_index.md) is a section page. See https://gohugo.io/getting-started/glossary/#section-page.

In Hugo parlance, in some contexts, "section page" and "list page" can be interchangeable. See https://gohugo.io/getting-started/glossary/#list-page.

In Paige parlance, the menu is the optional horizontal list of links at the top of the page like Home, Content, Layouts, Search, etc.

Gotcha.


Paige doesn't control the capitalization of taxonomy terms like tag values. It looks like Hugo capitalizes words in taxonomy terms automatically. If you want to customize what's displayed, you can set the title in content/$taxonomy/$term/_index.md. Give "sliding-window" and get "Sliding-Window", "binary search" and "Binary Search", "foo_bar" and "Foo_bar" (apparently it considers x_y one word). Note that if you give "binary search" or "Binary Search", it will still map to binary-search.

Thanks! I created content/tags/sliding-window/_index.md:

---
description: "Sliding window"
title: "Sliding Window"
---

and got around it.

I suspect you have "binary search" or "Binary Search" in your front matter.

Nope, I hyphenate text in tags, categories, and authors.

I still don't understand why tag binary-search is listed as Binary Search but tag sliding-window is listed as Sliding-Window in the section page.

@willfaught
Copy link
Owner

"Sliding-Window" is consistent with the rules I described:

It looks like Hugo capitalizes words in taxonomy terms automatically

I don't understand why you're seeing "Binary Search" either. Can you point me to your code?

@willfaught
Copy link
Owner

See also: https://discourse.gohugo.io/t/are-term-capitalization-rules-documented-somewhere/50139

@saurabh-sm
Copy link
Author

Closing this as complete. Thanks for the suggestion Will !

@willfaught
Copy link
Owner

Did you find the cause of "Binary Search"?

@saurabh-sm
Copy link
Author

saurabh-sm commented Jun 4, 2024

Did you find the cause of "Binary Search"?

Nope, but I got around it thanks to your suggestion. I'm also unable to reproduce this on a fresh site, i.e., everything is hyphenated.

@willfaught
Copy link
Owner

Glad you were able to get unblocked.

@willfaught
Copy link
Owner

willfaught commented Jun 4, 2024

Answer: https://discourse.gohugo.io/t/are-term-capitalization-rules-documented-somewhere/50139/2?u=will

See: https://gohugo.io/getting-started/configuration/#capitalizelisttitles

And: https://gohugo.io/getting-started/configuration/#configure-title-case

capitalizeListTitles = false will disable the auto capitalization.

@saurabh-sm
Copy link
Author

Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants