How To: Hide Certain Tags From Displaying on Your Postach.io Site
We’re proud to feature this handy hack post from Nick Gracilla, principal of Neoteric Design, a craft-driven design and development firm in Chicago. Follow Nick’s blog for other homemade Postach.io hacks, or find him on Twitter!
Postach.io has great support for Evernote’s tagging feature: just tag your note as desired, and that tag will appear on your Postach.io blog - easy peasy.
One day, I noticed that the critical tag “published" is never shown. With this in mind, I realized that I may want to use other tags that I don’t need to show on my blog. For example, I might use private tags within Evernote that help me establish the edit status of a post, or an internal tagging system for content grouping.
Thus, the question becomes: How can I have Postach.io display some of my tags on my post, but not all of them?
This is pretty straightforward - it just requires a little bit of template hacking. First, we’ll create a list of tags that we want Postach.io to skip over. Then, we’ll find the various spots in the templates where tags are printed, and we’ll insert some conditional logic to only print out tags that aren’t in the list.
1. Create your list of hidden tags
You want your list of hidden tags to be easy to manage, so define it just once, and put the definition at the very top of your template. We’re going to create a variable, call it “skiptags", and give it a list of tags that we want skipped in our layout. Tags are text, so we’ll show them in single quotes.
2. Find the template spots that print out tags
Obviously, tags are printed at the end of a post. From this great tutorial on the Postach.io Blog that talks about how to use tags and tag clouds, you can see some code that does exactly this:
That is to say, “If there are any tags on this post, then make an unordered list in HTML, and for each of those tags, show it as a line item in that list."
We want to make a simple change to this logic - something that says: “If there are any tags on this post, then make an unordered list in HTML. And for each of those tags on this post, as long as it’s not in my skiptags list, then go ahead and show it." In code, this translates to:
Minor Caveats To Be Aware Of
Keep in mind, the post itself still contains all of your tags — we’re just not showing all of them to the user. Thus, tags can still be used to identify your posts in the Postach.io discover feature if someone searches for them. For example, even if you hide your “food" tags from showing your site, any posts tagged with "food" will still appear in Discover when someone enters the URL "http://postach.io/discover/food".
Of course, if your hidden tags only contain obscure words or phrases, you probably won’t run into this issue. Nevertheless, make sure to keep your super-secret, should-never-be-seen tags to yourself. Your posts will still be indexed under all of your tags when published to the web, even if you don’t display them on your site.
Tell me how it works!
Questions? Comments? Share your experiences with me on Twitter (@nicfits) or through the comments on my personal blog for Postach.io hacks.
Happy hacking! :)