【问题标题】:Can you customize the format of a Tumblr post based on its tag?你可以根据标签自定义 Tumblr 帖子的格式吗?
【发布时间】:2011-11-12 17:57:09
【问题描述】:

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

我还想偶尔做一个特殊的帖子类型,以展示我的摄影作品,但我不希望调整它的大小,而是希望以高分辨率完整展示照片主题的宽度(大约 1140px 宽)。

我已经阅读了有关 {block:HighRes} {/block:HighRes} 的信息,但似乎这是为了让 500 像素的图像点击原始图像。

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

这是我正在尝试做的一个视觉示例:http://i.imgur.com/23p09.jpg

【问题讨论】:

    标签: tumblr


    【解决方案1】:

    您可以使用{TagsAsClasses}

    例如对于这个 tumblr 标记

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

    还有 3 个带有此标签的帖子:

    1. 照片,高分辨率照片
    2. 照片,低分辨率照片
    3. 照片、摄影

    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%; }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      • 2021-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多