1

好的,这就是交易。我已经在多个网站上搜索了大约一周,包括这个关于如何从我的 Tumblr 博客的索引页面和标记页面中隐藏特别标记的帖子。为了让它更容易,请记住我确实对 html 和 css 有一些了解,因为这是我在一年内制作的第四个 Tumblr 主题,并且随着我的进展越来越好。所以,为了不浪费你的时间,我已经反复尝试了这些方法:

    1. <div id="posts {TagAsClasses}"></div>
    2. <div class="posts {TagAsClasses}"></div>
    3. {block:Posts}
       {block:HasTags}{block:Tags}<span class="tagged-{URLSafeTag}">{/block:Tags}{/block:HasTags}
       (*post content would go here*)
       {block:HasTags}{block:Tags}</span>{/block:Tags}{/block:HasTags}
       {/block:Posts}

这些都不起作用。最初我的帖子内容有一个 id 选择器,但将其更改为一个类,因为每次我输入 {TagAsClasses} 时,它都会弄乱整个页面并且发布 div 不再对应于 CSS。

当我尝试上课时,我的页面看起来完全一样,完全忽略了 {TagAsClasses}。

当我尝试第三种方法时,我不得不将它用于 CSS:

    .tagged-HIDDEN {
    {block:IndexPage}
    display:none !important;
    {/block:IndexPage}
    {block:TagPage}
    display:inline !important;
    {/block:TagPage}
    }

“隐藏”当然是我为要隐藏的帖子添加的任何标签。当我这样做时,涉及“!important”(这是我访问过的另一个博客的指示),当我到达一个包含我想要隐藏的帖子的页面时,我的博客甚至不会加载(我使用分页)。当我取出“!important”时,我的博客会加载,但标记的帖子会显示出来,只是 CSS 有点乱。

我什么都试过了,我什至试图改变

    <span class> to <span id>

在我改变之后

    <div id posts> to <div class>

因为我认为跨度会变得更强并且可以工作,但是我最终得到了与我之前提到的使用“!important”时相同的东西。

所以现在你已经看到了我尝试过的所有选项,这是我博客的完整 html/css:ℂħёℓ§εå ....

<meta name="color:Background" content="#000000">
<meta name="color:Primary Color" content="#000000">
<meta name="color:Secondary Color" content="#000000">

<meta name="color:Tertiary Color" content="#000000">
<meta name="color:Quaternary Color" content="#000000">
<meta name="color:Quinary Color" content="#000000">

<meta name="font:Sidebar Text" content="" />
<meta name="font:Posts Text" content="" />

<meta name="text:Sidebar Width" content="" />
<meta name="text:Sidebar Title Size" content=""/>
<meta name="text:Sidebar Description" content="" />

<meta name="image:Sidebar" content="" />
<meta name="image:Background" content="" />





<style>
html {

    background: -webkit-linear-gradient(top,{color:Background},white);
    background-attachment: fixed;
}
body {

}

#content {
    margin: 10px 0px 10px 260px;
    width: 1020px;
}

#content blockquote {
    border-left: solid black 1px;
    margin: 0px;
    padding-left: 10px;
    max-width: 100%;

}

    img {
    border: 0;
    max-width: 100%;
}

#content #posts {
    background-color: rgba(255,255,255,0.7);
    width: 250px;
    padding: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-left: 10px;
    margin-right: 10px;

    {block:PermalinkPage}
    width: 800px;
    {/block:PermalinkPage}
}

#content #posts .title {
  font-size: 15px;
  font-family: {font:Posts Text};
  color: {color:Primary Color};
}

#content #posts .text {
  font-size: 10px;
  font-family: {font:Posts Text};
  color: {color:Tertiary Color};
  max-width: 100%;
}

#content #posts .container {
    float: left;
}

#content a {
    text-decoration: none;
    color:{color:Quinary Color};
}




#posts .date {
    margin-top: 40%;
    margin-left: 40%;
}

#sidebar {
    font-family: {font:Sidebar Text};
    width: {text:Sidebar Width}px;
    float: left;
    position: fixed;

}

#sidebar .title {
    font-size: 30px;
    text-align: center;
}

#sidebar .title a {
    text-decoration: none;
    color: {color:Primary Color};
}

#sidebar .title a:hover {
    color: {color:Quaternary Color};
}

#sidebar .image {
    width: 250px;
    height: auto;
    border-radius: 100%;
}

#sidebar .description {
    font-size: {text:Sidebar Description}px;
    text-align: center;
    color: {color:Secondary Color};
}
#sidebar .links {
    margin-top: 10px;
    text-align: center;
}

#sidebar .links a {
    text-decoration: none;
    color: {color:Tertiary Color};
}

#sidebar .links a:hover {
    color: {color:Quaternary Color};
}

#sidebar .navigation {

}

#sidebar .navigation a {
    text-decoration: none;
    color: {color:Quinary Color};
}

#like_button {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    vertical-align: middle;
    margin-left: 75px;
    top: 50%;
    transition: .2s ease-in-out; 
   -moz-transition: .2s ease-in-out; 
   -webkit-transition: .2s ease-in-out;
   }

#reblog_button {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    vertical-align: middle;
    margin-left: 155px;
    top: 50%;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    }

#notecount {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    left: 20%;
    top: 60%;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    font-family: {font:Sidebar Text};
    font-size: 10px;
}

#date {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    left: 60%;
    top: 60%;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    font-family: {font:Sidebar Text};
    font-size: 10px;
}

#posts .postnotes {
    font-family: {font:Posts Text};
}

#posts .info {
    background: rgba(255,255,255,0.8);
    opacity: 0;
    position: absolute;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    width: 250px;
    bottom: 14px;
    top: 10px;
}

#posts:hover .info {
    opacity: 1;
    {block:PermalinkPage}
    opacity: 0;
    {/block:PermalinkPage}
}

#posts:hover #like_button {
    opacity: 1;
}

#posts:hover #reblog_button {
    opacity: 1;
}

#posts:hover #notecount {
    opacity: 1;
}

#posts:hover #date {
    opacity: 1;
}



</style>

<script type="text/javascript"   src="http://static.tumblr.com/d0qlne1/DiAl6ekb7/jquery-1.4.2.min.js"></script>
<script src="http://static.tumblr.com/twte3d7/H8Glm663z/masonry.js"> </script>

<script type="text/javascript">
$(window).load(function () {
$('#content').masonry({
itemSelector : ".container",
},
function() { $('#content').masonry({ appendedContent: $(this) }); }
);
});
</script>
</head>


<body>

<div id="sidebar">
<img class="image" src="{image:Sidebar}" />
<div class="title"><a href="{blogURL}">{Title}</a></div>

<div class="description">{block:Description}{Description}{/block:Description}</div>


<div class="links">
{block:AskEnabled}<a href="/ask">Ask</a>{/block:AskEnabled}
{block:SubmissionsEnabled}<a href="/submit">Submit</a>{/block:SubmissionsEnabled}
{block:HasPages}{block:Pages}<a href="{url}">{Label}</a>{/block:Pages}{/block:HasPages}
<a href="/dashboard">Dashboard</a>
</div>

<div class="navigation">
{block:Pagination} 
{block:NextPage}<p id="page_nav"><a style="float:left" href="{NextPage}"  id="next">Previous</a>{/block:NextPage}
{block:PreviousPage}<a style="float:right" href="{PreviousPage}">Next</a></p>{/block:PreviousPage}
{/block:Pagination}
</div>
</div>


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

<div id="posts">

<div class="info">
<div id="like_button">{likebutton}</div>
<div id="reblog_button">{reblogbutton color="grey"}</div>
<div id="notecount"><a href="{Permalink}#notes">{NoteCountWithLabel}</a>    </div> <div id="date"><a href="{Permalink}">{TimeAgo}</a></div>
</div>


<div class="container"> 
{block:Text}
{block:Title}<div class="title">{Title}</div>{/block:Title}
<div class="text">{Body}</div>

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>


{/block:Text}
</div> 

<div class="container"> 
{block:Quote}
<div class="title">"{Quote}"</div>
{block:Source}
<div class="text">{Source}</div>{/block:Source}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Quote}
</div>

<div class="container"> 
{block:Photo}
<img src="{PhotoURL-250}" />

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>

{/block:Photo}
</div>

<div class="container"> 
{block:Photoset}
{Photoset-250}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>

{/block:Photoset}
</div>

<div class="container"> 
{block:Video}
{Video-250}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Video}

</div>

<div class="container"> 
{block:Audio}
{AudioPlayer}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Audio}
</div>

<div class="container">     
{block:Answer}
<div class="title">{Question}</div>
<div class="text">~{Asker}</div>
<div class="text">{Answer}</div>

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Answer}
</div>

<div class="container"> 
{block:Chat}
{block:Title}{Title}{/block:Title}
{block:Lines}
{block:Label}<strong>{Label}</strong>{/block:Label}
{Line}
{/block:Lines}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Chat}
</div>

<div class="container"> 
{block:Link}
<a href="{URL}">{Name}</a>
{block:Description}{Description}{/block:Description}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Link}
</div>

</div>

{/block:Posts}
</div>

</body>
</html>

忽略缺少的 head 和 !D0CTYPE html 标签,它们在我的博客中,只是不会出现在这里。

4

1 回答 1

1

这就是我所做的,基本上我使用了 tumblr 的 META 标签,根据页面的不同有不同的 CSS。

<head>
//Your head and CSS stuff here
{block:IndexPage}
<style>
.BLOCKME {display:none !important;}
</style>
{/block:IndexPage}
</head>

这将阻止任何带有该标签BLOCKME的帖子显示在主页上,您还可以使用{block:TagPage} {block:PermalinkPage}{block:SearchPage}

附注以及您的帖子还必须包含class="{TagsAsClasses}"

于 2015-10-26T05:46:19.830 回答