Last Four Tweets:

Loading Tweet

If you can't wait...


  1. Notes: 1 / Sunday, January 17th, 3:44 ET

    Using {TagsAsClasses} In Tumblr

    It took a while, but I finally figured out how to differentiate text posts, like this one, from text posts that are imported automatically from my Twitter feed. You’ll notice that any posts that were imported from my Twitter feed will have, near the top, “This post was automatically imported from my Twitter feed.”

    The Tumblr {TagsAsClasses} dynamic tag identifies the root domain of the importing URL. In this specific case, that’s ‘twitter_com’. So, anywhere you put {TagsAsClasses} in your custom HTML will be rendered as twitter_com in the HTML, assuming that the post was imported from Twitter.

    The same hold true if the content was imported from another site, like Digg. In that case, {TagsAsClasses} would be rendered as digg_com.

    In my custom HTML, I added the following line to the section for text post templates, in the location that I wanted the text to be displayed:

    <div class=”{TagsAsClasses}”></div>

    In my example, this renders in the final HTML as:

    <div class=”twitter_com”></div>

    Then, in my CSS I defined:

    .twitter_com:before {
    content: “This post was automatically imported from my Twitter feed”;
    }

    So, any post imported from Twitter will load the div that calls the twitter_com class. That div will display the content, “This post was automatically imported from my Twitter feed.” You can see the end result on this blog.

    Of course, how this works, exactly, will vary depending on your template and how it’s set up.

    Now, I’d like to be able to automatically tag these imports as Twitter, but I haven’t figured that one out yet. I may actually remove the Twitter imports entirely, because I don’t want things to get too noisy.

    Comments
  2. Notes

    1. andrewbaisley posted this
  3. blog comments powered by Disqus
avatar_128
 
 

Andrew Baisley

Sr Solutions Engineer at
Tremor Media


LinkedIn Profile
Twitter Account

Contact me via email
Meet With Me

Subscribe to RSS

About This Site

General thoughts about the industry I work in, my life in New York City, the music I'm listening to and links to websites that I find interesting.

This is a personal blog and, while I may occasionally write about my work, my views do not represent the views of my employer or business partners in any way.

Ask me anything.
-->

 

Tools