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

categories in mixed (original) case *as well as* downcase #1739

Closed
paul-hammant opened this issue Nov 20, 2013 · 10 comments · Fixed by #2571
Closed

categories in mixed (original) case *as well as* downcase #1739

paul-hammant opened this issue Nov 20, 2013 · 10 comments · Fixed by #2571

Comments

@paul-hammant
Copy link

With ref to: 73ca35e

It would be awesome to have both the downcase that happened after #842 AND the original case of the category. Why? Then this would be possible, the world would look pretty again:

<a href="/all_your_scm_are_belong_to_us">All your SCM are belong to us</a>

I suggest something like post.categoriesOrigCase in additon to post.categories

-ph

@parkr
Copy link
Member

parkr commented Nov 26, 2013

How would you separate them?

@parkr
Copy link
Member

parkr commented Nov 26, 2013

category.link vs category.id vs category.name?

@mattr-
Copy link
Member

mattr- commented Nov 27, 2013

Perhaps category.slug as the lowercase version and category.name as the original case of the category?

@paul-hammant
Copy link
Author

I'm easy as to how you guys implement it. I'd just prefer to be able to have a choice for presenting in Liquid as I did before commit 73ca35e :)

@MartinThoma
Copy link

category.slug as the lowercase version (that can be used for the url) and category.name for the displayed text seem to be a good idea, because people might know "Post slug" from Wordpress (source).

Also, category.link seems to be not a good idea, because it is not obvious if this is an absolute URL, a relative URL or only the slug.

@paul-hammant
Copy link
Author

I got mixed case back again with some JavaScript hackery. http://paulhammant.com/categories.html

<script type="text/javascript">
  function fixupText(attr) {(
    $("." + attr).each(function() {
      var textNode = $(this);
      textNode.html(textNode.text().replace(/(?:^|\s)\w/g, function(match) {
       return match.toUpperCase();
      }).replace("Mvc", "MVC").replace("Nosql", "NoSQL").replace("-side", "-Side").replace("Branch By Abstraction, Etc", "Branch by Abstraction, etc").replace("Ui ", "UI ").replace("Devops", "DevOPS").replace("[", "<span>").replace("]", "</span>"));
    textNode.removeClass(attr);
  });
}  
</script>

and classes added to pertinent anchors and h2s.

@mhulse
Copy link

mhulse commented Jan 23, 2014

How would you separate them?

<my-2-cents>

My take on naming conventions:

  1. category.label === Human readable (humanized) version, like "I am a Duck".
  2. category.name === Geek version, like "i-am-a-duck" or "i_am_a_duck" (depends on context/needs of internal system).

An alternative to categroy.name might be category.title.

To me, a slug is a url-friendly version of a string. Most slug-generating methods/functions I've used will strip common words (like "a" or "the"). category.slug is still a good one to use, but I'd typically expect the common words to be removed. Using "slug" over "link" is definitely the better route to take here. 👍

Other ways I've seen an "original" string stored is to have a "raw" property. Like category.raw or category.name_raw.

</my-2-cents>

@manuelgruber
Copy link
Member

Is anybody working on that?

@parkr
Copy link
Member

parkr commented Feb 17, 2014

@manuelgruber No, not right now!

@parkr
Copy link
Member

parkr commented Nov 29, 2014

Tracking in #2977.

@parkr parkr closed this as completed Nov 29, 2014
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
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.

7 participants