Tumblr中帖子的连续编号

时间:2013-07-02 15:27:09

标签: tumblr

是否有聪明的方法在Tumblr帖子上进行顺序编号?我找到了一种添加JavaScript的方法,通过在头部创建一个Global var(weekNum = 0;),然后在相关部分添加:

<script type="text/javascript">
w= "<h3>Week " + (weekNum+1) + "</h3>";
weekNum++;
document.write(w);
</script>

这就像一个魅力,除了因为帖子是从最新到最旧生成的,所以编号是向后的。我正在寻找的方法是让我的帖子编号为“第1周”,“第2周”等。

先谢谢你,所有你比我更聪明的人......

1 个答案:

答案 0 :(得分:0)

您可以编辑主题,以便所有帖子都在编号列表中,即:

<ol id="posts">
        {block:Posts}{block:Text}
                <li class="post text">
                    {block:Title}
                        <h3><a href="{Permalink}">{Title}</a></h3>
                    {/block:Title}{Body}
                </li>
            {/block:Text}{block:Photo}
                <li class="post photo">
                    <img src="{PhotoURL-500}" alt="{PhotoAlt}"/>

                    {block:Caption}
                        <div class="caption">{Caption}</div>
                    {/block:Caption}
                </li>
            {/block:Photo}{block:Panorama}
                <li class="post panorama">
                    {LinkOpenTag}
                        <img src="{PhotoURL-Panorama}" alt="{PhotoAlt}"/>
                    {LinkCloseTag}{block:Caption}
                        <div class="caption">{Caption}</div>
                    {/block:Caption}
                </li>
            {/block:Panorama}{block:Photoset}
                <li class="post photoset">
                    {Photoset-500}{block:Caption}
                        <div class="caption">{Caption}</div>
                    {/block:Caption}
                </li>
            {/block:Photoset}{block:Quote}
                <li class="post quote">
                    "{Quote}"

                    {block:Source}
                        <div class="source">{Source}</div>
                    {/block:Source}
                </li>
            {/block:Quote}{block:Link}
                <li class="post link">
                    <a href="{URL}" class="link" {Target}>{Name}</a>

                    {block:Description}
                        <div class="description">{Description}</div>
                    {/block:Description}
                </li>
            {/block:Link}{block:Chat}
                <li class="post chat">
                    {block:Title}
                        <h3><a href="{Permalink}">{Title}</a></h3>
                    {/block:Title}

                    <ul class="chat">
                        {block:Lines}
                            <li class="{Alt} user_{UserNumber}">
                                {block:Label}
                                    <span class="label">{Label}</span>
                                {/block:Label}{Line}
                            </li>
                        {/block:Lines}
                    </ul>
                </li>
            {/block:Chat}{block:Video}
                <li class="post video">
                    {Video-500}{block:Caption}
                        <div class="caption">{Caption}</div>
                    {/block:Caption}
                </li>
            {/block:Video}{block:Audio}
                <li class="post audio">
                    {AudioPlayerBlack}{block:Caption}
                        <div class="caption">{Caption}</div>
                    {/block:Caption}
                </li>
            {/block:Audio}{/block:Posts}
</ol>