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

Make the title func follow some style guide #989

Closed
bep opened this issue Mar 20, 2015 · 6 comments · Fixed by #3753
Closed

Make the title func follow some style guide #989

bep opened this issue Mar 20, 2015 · 6 comments · Fixed by #3753
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Mar 20, 2015

This template func could be very useful, if it was done properly.

Right now it title cases first char of each word.

So

This is a title => "This Is A Title"

From the doc:

// Title returns a copy of the string s with all Unicode letters that begin words
// mapped to their title case.

Have a look at http://titlecapitalization.com/

Pick a style, but it would cool if AP style was the default, then add an option for the other two.

Do not underestimate the importance of this.

@anthonyfok - you are the style guide / copy edit expert in here. What do you think? I can implement this if more people than me thinks it is important ...

@EricR
Copy link

EricR commented Mar 24, 2015

I think this would be useful 👍

@anthonyfok
Copy link
Member

@bep: Hoho! You are flattering me! I am no expert. ;-)

But yes, I think what you suggest would be a great thing to have.
Hugo docs used to use text-transform: capitalize for the sidebar menu,
and having "Of", "The" etc. capitalized was very disconcerting,
hence commit 769ab9e.

The only concern I have is that languages other than English may have different styles/rules. For example, it seems to me that French titles tend to use "sentence case" rather than "title case". But I think I am worrying too much. ;-)

English is most likely the most-used language for Hugo and for any static website generator / CMS out there, so I'd say it is a very valuable feature and a noble effort. Thank you for taking this initiative!

@bep
Copy link
Member Author

bep commented Mar 25, 2015

I'm from Norway, and we have no title case ...

@bep
Copy link
Member Author

bep commented Mar 1, 2017

Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.

If this is a bug and you can still reproduce this error on the latest release or the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.

@bep bep closed this as completed Mar 27, 2017
@yihui
Copy link
Contributor

yihui commented Mar 28, 2017

I'd not say it is a bug, but... "This Is A Title" just looks terrible, although English is not my native language. I don't care which style to use, but any style would be significantly better than no style at all.

My actual use case is to display all category names of a site, and I'm in a dilemma. If I use preserveTaxonomyNames = true, I get ugly URLs (e.g. /categories/This is a Category/); if I set it to false (default), I get ugly names for humans (this-is-a-category). In the latter case, I could use string | humanize | title, but it gives me "This Is A Category". If only the original category names were stored and accessible from .Site.Taxonomies.categories...

@bep bep reopened this Jul 30, 2017
@bep bep self-assigned this Jul 30, 2017
@bep bep removed the Stale label Jul 30, 2017
@bep bep added this to the v0.26 milestone Jul 30, 2017
bep added a commit to bep/hugo that referenced this issue Jul 30, 2017
bep added a commit to bep/hugo that referenced this issue Jul 30, 2017
bep added a commit to bep/hugo that referenced this issue Jul 30, 2017
* AP style (new default)
* Chicago style
} Go style (what we have today)

Fixes gohugoio#989
bep added a commit to bep/hugo that referenced this issue Jul 30, 2017
* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes gohugoio#989
bep added a commit to bep/hugo that referenced this issue Jul 30, 2017
* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes gohugoio#989
bep added a commit to bep/hugo that referenced this issue Jul 31, 2017
This works for the `title` func and the other places where Hugo makes title case.

* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes gohugoio#989
bep added a commit to bep/hugo that referenced this issue Jul 31, 2017
This works for the `title` func and the other places where Hugo makes title case.

* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes gohugoio#989
@bep bep closed this as completed in #3753 Jul 31, 2017
bep added a commit that referenced this issue Jul 31, 2017
This works for the `title` func and the other places where Hugo makes title case.

* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes #989
@github-actions
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 Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants