{block:tags} + <title>标签中的第n个孩子</title>

时间:2013-03-05 11:18:50

标签: css tumblr block css-selectors

我目前正在研究我的tumblr主题,并试图为描述性标题找到一个很好的解决方法。

我目前正在使用'第一篇帖子就是标题'诀窍“在”主题内实现如此:

#tagoperator:nth-child(n+2)
{
Margin-top : 0px;
Margin-bottom : 0px;
}

{block:tags}<h1><a href="{Permalink}">{Tag}</a></h1>{/block:tags}

我正在尝试在我的标题标签中做同样的事情,但在使其工作时我很无能为力。

我能想象它运作的最佳方式是:

<title>{title} {block:tags}<h1>{tag}</h1>{/block:tags}</title>

但遗憾的是,这只是标题。

你们对我如何实施我正在尝试的内容有任何建议吗?

干杯,杰克

[编辑]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<head>

    <meta name="keywords" content="{block:Permalink}{block:Posts}{block:Tags}{Tag}, {/block:Tags}{/block:Posts}{/block:Permalink}" />   




    <!-- custom colors -->
    <meta name="if:Show Reblog Credit" content="1">
    <meta name="if:Show Tags" content="1">



    <meta name="font:TitleAndBody" content="Georgia">
    <meta name="font:DatesReblogTags" content="Verdana">
    <meta name="font:TextWithinBars" content="Verdana">
    <meta name="color:Background" content="#333333"/>
    <meta name="color:Title" content="#1D1801"/>
    <meta name="color:BodyText" content="#1D1801"/>
    <meta name="color:Links" content="#020202"/>
    <meta name="color:Bars" content="#1D1801"/>
    <meta name="color:TextWithinBars" content="#FFFFFF"/>
    <meta name="color:HeaderText" content="#FFFFFF"/>
    <meta name="color:NotesBackground" content="#FCFF8B"/>
    <meta name="color:TagsBackground" content="#E0F1FF"/>
    <meta name="color:PostTitleText" content="#ee84ad"/>
    <!-- those were the custom colors -->

    <meta name="if:Show notes" content="1"/>
    <meta name="text:Disqus Shortname" content="" />





<style type="text/css">





             a:link {color:#000000;}      /* unvisited link */
             a:visited {color:#000000;}  /* visited link */
             a:hover {color:#ee84ad;}  /* mouse over link */
             a:active {color:#000000;}  /* selected link */ 

body
{
    Background-color : #2c2b2b;    
    Font-family : {font:"TitleAndBody"};

}
#wrap
{
  width: 1000px;  


}
#h1:nth-child(n+2)
{
    Margin-top : 0px;
    Margin-bottom : 0px;
}

#tagoperator:nth-child(n+2)
{
}
#header
{
    margin: 0 auto; 
    position : relative;
    Width : 1000px;


}
    #header a.title
    {
        position : absolute;
        Width : 800px;
        Height : 300px;
        Margin-top : 10px;
        Color : {color:"title"};
        Padding-bottom : 10px;
        Padding-top : 10px;
        Font-size : 3.75em;
        Letter-spacing : -1px;
    }
    #header .banner
    {
        Margin-top : 10px;
        Padding-top : 6px;
        Width : 800px;
        Height : 300px;
    }
    #header .bar
    {
        Height : 24px;
        Width : 988px;
        Background : #7e7d79;
        Margin-top : 2px;
        text-transform: uppercase;
        Font-family: Courier New;
        Font-size : 16px;
        Line-height : 1.8em;
        Color : "headertext";
        Text-align : Left;
        Padding-right: 6px;
        padding-left: 6px;
        padding-bottom:  6px;
    }
    #header .bar a
    {
        Color : #FFFFFF;
        Text-decoration : underline;
    }
    #header .bar a:hover
    {
        Text-decoration : underline;
        Color : #ee84ad;
    }

#content
{
    Position: Relative;
    Width : 1000px;
    top : 30px;



}

    #content .space {

        width: 100%;
        clear: both;

        }

        #content .space.big{
        height: 30px;
        }

        #content .space.small{
        height:3px;
        }

#content #sidebar {

            text-transform: uppercase;
        Font-family: Courier New;

            width: 300px;
            height: 200px
            display:block;
            position: absolute;
            margin: 0px auto;

            float: right;
            right: 0px; 
            top: 1px;

            background-color: #ecece9;

            }        

#content #post {
    float: left;
    background-color: #ecece9;
    display:block
    width: 680px;
    top: 420px;
    left: 0px;
    clear: both;


}   

#content #post:link {
                color: "white"

            }

                #content #post .left {
                    width: 680px;
                    Font-family: Courier New;
                    text-transform: uppercase;
                    padding-left: 6px;
                    font-size: 0.69em;
                    text-align: left;

                }

                #content #post .left h1:nth-child(n+2) 
                {display: none;}{



                    }



                    #content #post .left a.timestamp {
                        width: 174px;
                        height: 21px;
                        color: {color:TextWithinBars};
                        text-decoration: none;
                        line-height: 1.8em;
                        background: {color:Bars};
                        padding: 0 6px;
                        display: block
                    }

                    a.comments {
                        color: {color:BodyText};
                        font-family: courier new;
                        text-transform: uppercase;
                        font-size: 9pt;
                        text-align: right;
                        text-decoration: none !important;
                        border-bottom: 1px solid #ccc;
                        padding: 6px  6px 6px 0;
                        display: block;

                    }

                    a.comments:hover {
                        color: #ee84ad;
                    }

                    #content #post .left .notes {
                        width: 265px;
                        color: #9C9C9C;
                        padding: 6px 2px 0 2px;
                    }

                        #content #post .left .notes a {
                            color: #9C9C9C;
                            text-decoration: none;
                            padding: 1px 3px;
                        }

                    #content #post:hover .left .notes {
                        color: {color:BodyText};
                    }

                        #content #post:hover .left .notes a {
                            color: {color:BodyText};
                            background-color: {color:NotesBackground};
                            filter: alpha(opacity = 95);
                            -moz-opacity: 0.95;
                            -khtml-opacity: 0.95;
                            opacity: 0.95;
                        }

                        #content #post .left .notes a:active {
                            filter: alpha(opacity = 100);
                            -moz-opacity: 1.0;
                            -khtml-opacity: 1.0;
                            opacity: 1.0;
                        }

                    #content #post .left .tags {
                        width: 138px;
                        float: right;
                        padding: 6px 3px 0 0;


                    }

                        #content #post .left .tags a.tag {
                            color: #9C9C9C;
                            text-decoration: none;
                            border-radius: 3px;
                          -moz-border-radius: 3px;
                          -webkit-border-radius: 3px;
                            padding: 1px 3px;
                            margin: 0 0 3px 3px;
                            float: right;
                        }

                        #content #post:hover .left .tags a.tag {
                            color: #ee84adA;
                            background-color: {color:TagsBackground};
                            filter: alpha(opacity = 95);
                            -moz-opacity: 0.95;
                            -khtml-opacity: 0.95;
                            opacity: 0.95;
                        }

                            #content #post:hover .left .tags a.tag:active {
                                background-color: #D2EAFD;
                                filter: alpha(opacity = 100);
                                -moz-opacity: 1.0;
                                -khtml-opacity: 1.0;
                                opacity: 1.0;
                            }
    #content #post .right {
                    width: 674px;
                    line-height: 1.7em;
                    float: right;
                    font-size: 9pt;
                    padding: 10px 10px 10px 10px;
                    padding-right: 6px;
                    padding-left: 0px;
                    font-family: Georgia;
                    text-transform: none;


                }

                    #content #post .right img {
                        max-width: 100%;
                    }

                    #content #post a {
                        text-decoration: underline;
                    }

                    #content #post blockquote {
                        font-style: italic;
                        padding-left: 15px;
                        border-left: 2px solid #1D1801;
                    }

                    #content #post .right a.title {
                        color: {color:BodyText};
                        font-size: 1em;
                        font-weight: bold;
                        text-decoration: none;
                    }

                    /* this is for chat */
                    #content #post .right table {
                        border-collapse: collapse;
                    }

                        #content #post .right table tr.line1 {
                            margin: 0;
                        }

                        #content #post .right table tr.line2 {
                            margin: 0;
                            background-color: #EEEEEE;
                        }

                        #content #post .right table tr td {
                            padding: auto;
                            vertical-align: top;
                        }

                        #content #post .right table tr td.name {
                            text-align: right;
                            font-weight: bold;
                            padding: 2px 15px;
                        }

                        #content #post .right table tr td.words {
                            width: 100%;
                            text-align: left;
                            padding: 2px;
                        }
                        /* that was for chat */

                    #content #post .right .quote .mark {
                        font-size: 3.75em;
                        line-height: 0.9em;
                        float: left;
                        margin: 0 15px -20px 0;
                    }

                        #content #post .right .quote .byline {
                            text-align: right;
                        }

                        #content #post .right .quote .words {
                            width: 445px;
                        }

                    #content #post .right a.link {
                        color: {color:Links};
                        font-size: 1em;
                        font-weight: bold;
                        text-decoration: none;
                        border-bottom: 2px solid {color:Links};
                    }

                    #content #post .right .audio embed {
                        border: 1px solid #9C9C9C;
                    }



#footer {
        width: 686px;
        text-transform: uppercase;
        Font-family: Courier New;
        font-size: 16px;
        background-color:  #7e7d79;

    }

        #footer #pagination {
            width:770px;
            height: 21px;
            color: {color:TextWithinBars};
            line-height: 1.8em;
            text-align: center;
            position: relative;
            padding: 6px;
        }

            #footer #pagination .count {
                position: absolute;
                left: 6px;
            }

            #footer #pagination a {
                color: #FFFFFF;
                text-decoration: none;
            }

        #footer #credit {

            color: #9C9C9C;
            text-align: center
            padding-top: 6px;
            padding-bottom:6px;
        }

            #footer #credit:hover {
                color: {color:BodyText};
            }

            #footer #credit a {
                color: #9C9C9C;
                text-decoration: none;
                padding: 1px 3px;
            }

                #footer #credit:hover a {
                    color: #1D1801;
                    background-color: {color:NotesBackground};
                    filter:alpha(opacity=95);
                    -moz-opacity:0.95;
                    -khtml-opacity: 0.95;
                    opacity: 0.95;
                }

                    #footer #credit:hover a:active {
                        filter:alpha(opacity=100);
                        -moz-opacity:1.0;
                        -khtml-opacity: 1.0;
                        opacity: 1.0;
                    }

    ol.notes {
        padding: 0px;
        margin: 55px 0px 25px 0;
        list-style-type: none;
    }

    ol.notes li.note {
        background: #f4f4f4;
        margin: 0 0 2px 0;
        padding: 10px;
    }

    ol.notes img.avatar {
        max-width: 16px;
        margin-right: 8px;
        border: solid 1px #ccc;
        padding: 1px;
        float: left;
    }

    ol.notes span.action {
        float: left;
        padding-top: 1px;
        line-height: 18px;
    }

    ol.notes .clear {
        clear: both;
        height: 1px;
    }

    ol.notes blockquote {
        border-color: #eee;
        padding: 4px 10px;
        margin: 7px 0px 0px 25px;
        font-weight: normal;
        line-height: 18px;
    }

    ol.notes blockquote a {
        text-decoration: none;
    }

    ol.notes .answer_content {
        font-weight: normal;
    }

    {CustomCSS}


    </style>

<link rel="shortcut icon" href="{Favicon}">
    <link rel="alternate" type="application/rss+xml" title="RSS" href="{RSS}" />


<script type="text/javascript">
<!--
function handleThis(formElm)
{
window.location="http://jack-luke.tumblr.com/tagged/"+formElm.number.value+"";
return false;
}
// -->
</script>   

    <!--jQuery-->
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

        <!--Custom 404 page-->
        <script>
        $(document).ready(function() {
            $("p:contains(The URL you requested could not be found.)").html('</3 No posts with that tag found.');
        });
        </script>
        <!--End custom 404 page-->

       <script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher:'c369a40f-7921-40fc-9764-9fc9de08cc3d'});</script>

<script type="text/javascript">

  var _gaq = _gaq || [];
  var pluginUrl = 
  '//www.google-analytics.co.uk/plugins/ga/inpage_linkid.js';
  _gaq.push(['_require', 'inpage_linkid', pluginUrl]);
  _gaq.push(['_setAccount', 'UA-38988363-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head> 


<body>

<title>{title}{block:tags} | <h1>{tag}</h1>{/block:tags}</title>



<div id="wrap">

    <div id="title">

    </div>





    </div>
    <div id="header">


    <div style= "background-color: #ecece9;">

        <a href="/"><img src="http://img.jackluke.co.uk/my_country_blog/title-banner.png">

        <a class="banner"><img src="http://img.jackluke.co.uk/my_country_blog/banner_photos/glen_devon.jpg">
        </a>



        <div class="bar">


        <div style = "text-align:left; float:left;">
      {block:HasPages}
        {block:Pages} | <a href="{URL}">{Label}</a> | {/block:Pages}
        {/block:HasPages}
        </div>

        <div style = "text-align:right; float:right">

        | 

        <a href="/about">{lang:About}</a> | | 

        <a href="/rss">{lang:Subscribe}</a> | | 

        <a href= "mailto:jack.jd.luke@gmail.com" >E-mail</a> | 

        </div>


        </div>
    </div>


<div id="content">
        {block:Posts}

        <div id="post">

            <div class="left">         

               {block:tags}<h1><a href="{Permalink}">{Tag}<div style= "text-decoration: none; display: inline; float: right; padding-right: 6px;"> <img src=http://img.jackluke.co.uk/my_country_blog/bike_post_icon.png /></div></a></h1>
                {/block:tags}

                <a href="{Permalink}" class="timestamp">


                {block:Date}{block:NewDayDate}{ShortMonth}. {DayOfMonth}, {Year} at {block:NewDayDate} {12Hour}:{Minutes}{AmPm} {/block:Date}
                </a>
                {block:Date}



                {block:IfShowReblogCredit}
                {block:RebloggedFrom}
                <div class="notes">
                    {lang:Reblogged from ReblogParentName 2}
                </div>
                {/block:RebloggedFrom}
                {/block:IfShowReblogCredit}

                <div style="text-align:right;">






                {block:IfShowTags}

                  {block:HasTags} 
                <div class="tags">
                    {block:Tags}<a href="{TagURL}" class="tag">{Tag}</a>
                      {/block:Tags}

                </div>
                <div class="space small"></div>
                {/block:HasTags}
                {/block:IfShowTags}
            </div>


            <div class="right">

        {block:Text}


                                {Body}


                {block:More}<a href="{Permalink}">{lang:Read more}</a>{/block:More}

        {/block:Text}

        {block:Photo}
                {LinkOpenTag}<img src="{PhotoURL-500}" alt="{PhotoAlt}">{LinkCloseTag}
                <div class="space small"></div>
                {block:Caption}{Caption}{/block:Caption}
        {/block:Photo}

        {block:Video}
                {Video-500}
                <div class="space small"></div>
                {block:Caption}{Caption}{/block:Caption}
        {/block:Video}

        {block:Photoset}
                {Photoset-500}
                <div class="space small"></div>
                {block:Caption}{Caption}{/block:Caption}
        {/block:Photoset}

        {block:Audio}
                <div class="audio">
                    {block:AudioEmbed}
                        {AudioEmbed-500}
                    {/block:AudioEmbed}

                    {block:AudioPlayer}
                        {AudioPlayerWhite}&nbsp;&nbsp;{block:ExternalAudio}<a href="{ExternalAudioURL}" class="download_link">{lang:Download}</a>{/block:ExternalAudio}
                    {/block:AudioPlayer}
                </div>
                {block:Caption}{Caption}{/block:Caption}
        {/block:Audio}

        {block:Chat}
                {block:Title}
                <a class="title" href="{Permalink}">{Title}</a><br />
                <div class="space small"></div>
                {/block:Title}
                <table>
                    {block:Lines}
                    {block:Label}<tr class="line{UserNumber}"><td class="name">{Label}</td>{/block:Label}<td class="words">{Line}</td></tr>
                    {/block:Lines}
                </table>
        {/block:Chat}

        {block:Quote}
                <div class="quote">
                    <div class="mark">&#8220;</div>
                    <div class="words">{Quote}</div>
                    {block:Source}<div class="byline">&mdash; {Source}</div>{/block:Source}
                </div>
        {/block:Quote}

        {block:Link}
                <a class="link" href="{URL}" {Target}>{Name}</a><br />
                <div class="space small"></div>
                {block:Description}{Description}{/block:Description}
        {/block:Link}

                {block:Permalink}
                {block:IfShowNotes}{PostNotes}{/block:IfShowNotes}

                {block:IfDisqusShortname}
                <div class="notecontainer" style="margin: 40px 0 0 0; padding: 0;">
                  <div id="disqus_thread"></div>
                  <script type="text/javascript" src="http://disqus.com/forums/{text:Disqus Shortname}/embed.js"></script>
                  <noscript><a href="http://{text:Disqus Shortname}.disqus.com/?url=ref">{lang:View the discussion thread}</a></noscript>
                </div>
                <div style="text-align: right; margin-top: 5px">
                  {lang:Blog comments powered by Disqus 2}
                </div>
                {/block:IfDisqusShortname}
                {/block:Permalink}
            </div>

    </div>



        <div style= "display: inline; float: left; padding-left: 4px;"><span st_url='{Permalink}' st_title='{Title}' class='st_fblike' displayText='Facebook Like'></span><span st_url='{Permalink}' st_title='{Title}' class='st_twitter' displayText='Tweet'></span><span st_url='{Permalink}' st_title='{Title}' class='st_email' displayText='Email'></span></div>

         {block:IfDisqusShortname}<div style= "display: inline;"><a href="{Permalink}#disqus_thread" class="comments">{lang:View comments}</a></div>{/block:IfDisqusShortname}
         {/block:Date}


        <div class="space big"></div>
        {/block:Posts}


     <div id="sidebar">


<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fmycountrybike&amp;width=292&amp;height=258&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;border_color=%237e7d79&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:292px; margin: 0 auto; padding: 6px; text-transform: uppercase; Font-family: Courier New; allowTransparency="true""></iframe>



<div style="height: 30px; background-color:#2c2b2b; width:100%"></div>

<div style="padding:6px">
<form onsubmit="return handleThis(this)">
<input type="text" name="number" />
<input type="submit" value="Search Tags" />
</form>
</div>

<div style="height: 30px; background-color:#2c2b2b; width:100%"></div>

<div style="padding: 6px; Font-family: {font:HeaderText}; Font-size: 20px; Line-height: 2em; Color: {color:title};">

Popular Photosets

<script src="http://studiomoh.com/fun/widgets/izer.php?base-hostname=jack-luke&type=photo&tag=&exclude_tag=old&show_reblogs=0&expires=90&layout=vertical&limit=5&width=200&height=300"></script><br />


</div>



</div id="content">


    <div id="footer">

        {block:PermalinkPagination}
        <div id="pagination">
            {block:NextPost}
            <a href="{NextPost}">&lt;</a>&nbsp;&nbsp;&nbsp;
            {/block:NextPost}
            {block:PreviousPost}
            <a href="{PreviousPost}">&gt;</a>
            {/block:PreviousPost}
        </div>
        {/block:PermalinkPagination}

        {block:Pagination}
        <div id="pagination" style="text-transform:lowercase;">
            <div class="count">{lang:CurrentPage of TotalPages}</div>
            {block:PreviousPage}
            <a href="{PreviousPage}">{lang:Previous}</a> | 
            {/block:PreviousPage}
            {block:NextPage}
            <a href="{NextPage}">{lang:Next page}</a>
            {/block:NextPage}
        </div>
        {/block:Pagination}

        <div id="credit">
            All images and content copyright Jack Luke, {CopyrightYears}.
        </div>  
    </div>




    {block:IfDisqusShortname}
  <script type="text/javascript">
  //<![CDATA[
  (function() {
    var links = document.getElementsByTagName('a');
    var query = '?';
    for(var i = 0; i < links.length; i++) {
      if(links[i].href.indexOf('#disqus_thread') >= 0) {
        query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
      }
    }
    document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/{text:Disqus Shortname}/get_num_replies.js' + query + '"></' + 'script>');
    })();
    //]]>
    </script>
  {/block:IfDisqusShortname}
</div id="wrap">    
</body>
</html>

1 个答案:

答案 0 :(得分:0)

title element可能只包含文字,而不是标记:

  

内容模型:
       文本。

因此不允许h1中的<title>{title} {block:tags}<h1>{tag}</h1>{/block:tags}</title>元素。