Created
August 29, 2012 00:36
-
-
Save matthewcopeland/3505659 to your computer and use it in GitHub Desktop.
Adding a category class to your octopress blog so you can attached an icon/color to the cat. two methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Or use this method... | |
| // | |
| // E[foo$="bar"] | |
| // an E element whose "foo" attribute value ends exactly with the string "bar" | |
| // | |
| // http://www.w3.org/TR/css3-selectors/#attribute-selectors | |
| a.category[href$="css/"] { | |
| padding-left: 20px; | |
| background: url('your-icon.png') left center no-repeat; | |
| } | |
| // this works really well because you won't need the '/' at the end of your string. | |
| a.category[href*="css"] { | |
| padding-left: 20px; | |
| background: url('your-icon.png') left center no-repeat; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # or you could just add a class | |
| # line 146 of category_generator.rb | |
| --- "<a class='category' href='/#{dir}/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>" | |
| +++ "<a class='category #{item}' href='/#{dir}/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment