你能根据标签自定义Tumblr帖子的格式吗?

时间:2011-11-12 17:57:09

标签: tumblr

做一个自定义的Tumblr主题,它将混合使用常见的Tumblr后期类型(文本,图片,链接等)。

我也喜欢偶尔做一个特殊的帖子类型,这将是我的摄影作品,但我不希望它被调整大小,而是我想在高分辨率下拍摄完整的照片主题的宽度(约1140px宽)。

我已经阅读了{block:HighRes} {/ block:HighRes},但似乎这是为了让500px图像点击到原始版本。

有没有办法禁用这些特定功能摄影帖的自动重新调整大小?也许是一种基于帖子标签改变行为的方法? (例如,如果它有“#photography”标签,则以全分辨率显示 - 如果没有,请继续并调整为500px宽)。

以下是我正在尝试做的一个直观的例子:http://i.imgur.com/23p09.jpg

1 个答案:

答案 0 :(得分:7)

您可以使用{TagsAsClasses}

例如,此 tumblr标记

{block:Posts}
    <div class="entry {TagsAsClasses}">
     Post Content
    </div>
{/block:Posts}

和3个有这个标签的帖子:

  1. photo,photo-hi-res
  2. photo,photo-low-res
  3. 照片,摄影
  4. Tumblr输出 html标记

    <div class="entry photo photo-hi-res">
     Post Content
    </div>
    <div class="entry photo photo-low-res">
     Post Content
    </div>
    <div class="entry photo photography">
     Post Content
    </div>
    

    此标记可以用小 css

    处理
    /* common for photo posts */
    .entry.photo {}
    
    /* `hi-res`-tag photo posts */
    .entry.photo-hi-res {}
    
    /* `low-res`-tag photo posts */
    .entry.photo-low-res { width: 500px; }
    
    /* `photography`-tag photo posts */
    /* the rule you need */
    .entry.photography { width: 900px; }
    .entry.photography img { width: 100%; }
    
相关问题