Skip to content

Instantly share code, notes, and snippets.

@diklein
Last active January 1, 2016 09:38
Show Gist options
  • Save diklein/8125796 to your computer and use it in GitHub Desktop.
Save diklein/8125796 to your computer and use it in GitHub Desktop.
Debut Tumblr Theme: How to show content *only* on the homepage. My goal is to place a few paragraphs of text above the blog posts on the homepage. The text will not appear on tag pages, search pages, or other index pages. Check it out on diklein.com.
<style>
.hidden { display: none; }
</style>
{block:IndexPage}
<div id="index" {block:SearchPage}class="hidden"{/block:SearchPage}>
<div class="content {block:TagPage}hidden{/block:TagPage}” role="main" id="introtext">
<article class="post post-type-text">
<div class="container">
<div class="post-body wysiwyg">
<p>Text!</p>
</div>
</div>
</article>
</div>
</div>
{/block:IndexPage}
<!--{block:Posts}-->
<script type="text/javascript">
if( {CurrentPage} != 1 ) {
document.getElementById("introtext").className += " hidden";
};
</script>
@ljharb
Copy link

ljharb commented Dec 25, 2013

Extra quote on line 20. Also you should add " hidden" in case there's already a class there.

@diklein
Copy link
Author

diklein commented Dec 25, 2013

Fixed and fixed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment