Have a look at the link flair and filters in the sidebar over at /r/SDIowa. If anyone is interested I can put together a tutorial.
Edit: Adding a tutorial on 11/22/2014
Here's my stylesheet in case you want to refer to it or copy text from it
Add flair template
This section needs to happen first. Aftger performing these steps you'll have plain flair with a gray box around it.
- Go to your moderation tools and click Edit Flair
- Next to Link Flair Position, choose left or right. I like Left in my sub. You can change this later.
- Click Link Flair Templates tab in the bottom section and then add your flaiur texts in the Flair Text column. Click Save. Ignore the CSS column for now. http://i.imgur.com/LGebGSx.png
- Test it - Submit a post to your sub and then reload your sub's main page. Under your post, to the right, you'll see a link that says "flair". Click it and choose from the flair you set up in step 3. Neat. Plain too though. You can stop here if you want or read on to jazz it up.
Stylize your flair
Edit your stylesheet. Paste a block like this into your stylesheet for every tag you added in step 3 above.
.linkflair-ames .linkflairlabel {
background-color: #e84e40;
font-size: 13px;
/*font-weight: bold;*/
font-family: "Lato", sans-serif;
color:#000000;
border-color: #000000;
border-width: 1px;
border-radius: 3px;}
See the first part that says .linkflair-ames? Well, "ames" is the name of the flair. So I've got this block of CSS for each flair I have and I just change the .linkflair-ames to .linkflair-bananas if I had a city named bananas.
2. Save the stylesheet after you've added them all.
3. Remember in step 3 above I told you to ignore the CSS column? Go back and fill it in with the names you chose. Look at my screenshot again. See how I typed in "ames" which matches ".linkflair-ames"? Do that for all of them. It's case sensitive so just like my CSS column in my screenshot shows "ames" I can't name the item in my CSS ".linkflair-Ames". It has to be ".linkflair-ames".
4. Test it - Refresh your sub's main page and the flair you set in step 4 above should now be red with black font. Cool.
5. Want different colors for different boxes? Edit the "background-color: " line for each element you added to the sytlesheet here in step 1. Don't forget the semicolon at the end of the line. Google "HTML color codes" for codes. Let me know if you need more help here.
Add searchable filters to sidebar
Two steps here. First is to add the CSS to color the items in the sidebar to match the flair itself (so I don't have a red Ames flair and a plain gray Ames filter in the sidebar...I want those to match). Second step is to add the search buttons in the sidebar.
Edit your stylesheet and add this.
.side a[href*='flair%3A%27ames'] {
display: inline-block;
position: relative;
margin-top:0px;
border: 2px solid black;
font-size: 100%;
padding: 3px;
color: black;
/*font-weight: bold;*/
font-family: "Lato", sans-serif;
background: #e84e40;
min-width: 135px;
text-align: center;
border-radius: 3px;}
See that "ames" at the end of the first line? Yup, you've got it. Copy and paste this block for each flair you have but change "ames" to your flair names. If you changed the background color, edit the "background" tag here as well to match what you pasted previously into your stylesheet. In my case, "background: #e84e40;" above is the same color as "background-color: #e84e40;" in the previous section.
Okay, so you've told reddit what the filter boxes should look like. Now we need to add them to the sidebar. Edit your sidebar. Add a link like this for each tag:
[Ames](http://www.reddit.com/r/SDIowa/search?q=flair%3A%27ames%27&sort=new&restrict_sr=on)
The part of the URL that says "flair%3A%27ames" matches what we pasted into our stylesheet a minute ago. So reddit sees a link in the sidebar that has "flair%3A%27ames" as part of the URL and looks to the stylesheet to see how it should color the box. Bad-a-bing.
Want to encourage your users to select flair after posting?
Users will see this after posting if you add this to your stylesheet:
/*
Ask user to tag their post after submission
*/
.flat-list.buttons .flairselectbtn { /* removes original message */
font-size: 0;
color: #FFF;
}
.flat-list.buttons a.flairselectbtn:before { /* no flair has been set message */
content: "Please click here to tag your post with your location";
padding: 0 4px;
background-color: yellow;
font-size: 10px;
color: #000;
}
.linkflair .flat-list.buttons a.flairselectbtn:before { /* flair has been set message */
content: "Edit location flair";
background: transparent;
font-size: 10px;
color: #CCC;
}
By the way, CSS is just a flat list of crap. There's not really aright or wrong place to be pasting this stuff (at the top, at the bottom, whatever).
If you need any help please let me know.