Via E-mail:

Making technology easier to understand.

Hiding Static Pages from Main Page in Blogger

You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “Hiding Static Pages from Main Page in Blogger”.

65 people had something to say about “Hiding Static Pages from Main Page in Blogger”:

Comments

  1. jared -

    I have multiple static pages with the same date, but with the code as I have entered it, it only hides one of the static posts and displays the others. Do I need to change the code in another way?

    Thanks!

    • Paul -

      I updated the code to move the date check. The problem is that posts after the first one for a specific date don’t have a date header, only a time stamp. I modified the code to first check to make sure the post has a date stamp, before performing the date value check.

      • jared -

        Paul,

        Terrific! That worked great. Thanks for your help and I really appreciate all the work you have put into this. It has been tremendously helpful and very informative.

  2. Roj Blake -

    Man, I super appreciate the work you’ve done sharing your solutions. I just did the way to hide it from the archive, and that worked perfectly, but I can’t get this to go. Maybe I’m not so good at this:

    I’ve pasted the code in, and instead of hiding the posts matching the “Phantom Date”, it’s hiding any post made on the same day, after the first made on that day. (ie only the first post of the day will show up).

    I did notice, and it’s really bugging me, that the quotes around “June 23…” in the code have been replaced by " but for the life of me couldn’t get regular quotes to stick. Maybe that’s my problem?

    • Paul -

      Did you remember to change the date in the code to match your “Phantom date”?

      The quotes in the code will automatically be converted to " by Blogger. This will have no effect on the code. I included the actual quote character above (“) since it is easier to read than including ".

      • Roj Blake -

        Being the sort of lazy person that uses code generous people post to their blog, and (though very rarely) posts comments complaining they can’t get it to work, I was using the same date as you.

        However, my date FORMAT was including the day as well (ie Sumday, Avril 2020), changing that and it all works.

        I can’t thank you enough for providing this information AND volunteering to help out. A huge help for the less gifted.

        • Paul -

          No problem. The date format has gotten me frustrated when trying to get something to work in the past.

  3. jared -

    Paul,

    Thanks again for your help, I was wondering if I could trouble you one last time. Is there a certain place in the code to look to ensure that the comments box will appear in the static pages? Viewers are able to leave comments on my main page under the posts, but on each static page there is no link to comment only the “Post Comments (ATOM)” link. I am wondering if I altered the code somehow when following the instructions you posted for creating static pages version 1 and 2.

    Thanks!

    Jared

    • Paul -

      Depending on which static page tutorial you followed, you may have disabled the comments for your static page. In version 1 I mention disabling comments when creating the static page. In version 2, you can keep the comments enabled.

      At the bottom of the post editor, click the “Post Options” link. Under “Reader Comments”, ensure the “Allow” option is selected for you static pages.

  4. jared -

    Thanks Paul, Unfortunately I have the Allow Comments option chosen for all three static pages. At the bottom of the pages there is the normal “Posted By” and “time”, but no link to leave comments, which is why I thought it may be something in the code where it loops through the date and time stamps. It’s odd indeed.

  5. Alannah -

    Hi Paul,

    Thank you for posting the codes! I tried this on my test blog, and it does hide the static page, but unfortunately, it also hides other posts that have a different, more current date. I posted it as was shown above, and the backdated post for the static page is dated August 14, 2007, and the “newer” post is dated September September 14, 2009. I thought it might be the fact that they both have a date of 14 that was causing the problem, but when I changed the newer one to September 13, 2009, it still had this same problem. What do you think could be causing this problem? Thank you so much!

    • Paul -

      Can you send me your template and I’ll have a look?

      • Alannah -

        Hi Paul,

        I finally got it to work-I realized I just placed the code with the wrong tag (there were two of them in my layout). Thanks again for sharing this with us!!

        Alannah

  6. Evangeline -

    Hi Paul,

    Is there any way to tweak this code for those of us with customized templates that use timestamp code instead of dateHeader? I’m missing lines 2,3,4 (since I have no date headers) and 14, 15, 16 (not sure why) of the snippet we’re supposed to look for in our templates.

    • Paul -

      You can still use the dateHeader tag in your code, even though you don’t display the date. The dateHeader is always available, but some templates may not use it to display the date.

      • Evangeline -

        Worked like a gem! Thanks so much!

        • Evangeline -

          Actually, there is one hiccup – adding the new code has resulted in date headers being applied to my non-hidden posts. Any easy fix for this?

          • Paul -

            Can you clarify “non-hidden posts”?

            • Evangeline -

              Non-hidden posts = The posts on my blog I don’t want to make hidden static pages; regular blog posts. I went into my blog post menu and unchecked the date header option in an attempt to get rid of it, but this ended up hiding every single post on the blog.

              • Paul -

                Did you want to remove the date header from all your posts? You can try editing the HTML for your posts and remove the tag from your template. Be sure to backup your template first.

                • Evangeline -

                  I couldn’t find any date header tags except for this code, but changed the dates to white so they won’t show up instead. :)
                  In the meantime, however, I’ve discovered I have the same problem as Roj above – only the first post of the day shows up, nothing afterwards. I’ve doublechecked my code for the same date error, i.e. putting the wrong date or the wrong format, but it’s all correct. Any advice?

                  • Evangeline -

                    Clarification: the posts made on my phantom date have disappeared like promised; the problem I’m having is the additional disappearance of all posts after the first post on a non-phantom date.

                    • Evangeline -

                      Any suggestions for solving this problem? I don’t have much expertise in HTML, so I’m at a loss. :/ I would really like to post multiple times in a day – and have all the posts show up.

  7. anshul -

    thanks a lot for sharing it with us… you are gem of a person..i am impressed and have subscribed to your site :)

  8. ill66 -

    that’s the first one of your hacks i can’t get working :(
    i tried several times, but strangely enough the main change was, that the displayed date on my blog seems to loose it’s style information (switched to default).
    several other phenomenons occurred, which i can’t report *dizzy*

    • Paul -

      When you copy the code, ensure you use the same style (h2 or p) and CSS class that was in your original code. The styling of my code may not match yours.

  9. ill66 -

    i just detected my initial code is a little different from yours:
    http://pastebin.com/f524700f5

    is there a solution for me, anyhow?

    • Paul -

      I made the change on the link. Make sure you backup your template before copying any new changes to your template.

  10. ill66 -

    i just could try it out in a hurry (i’m @work right now ;) ), but the only thing happend was, that on the main page only 3 postings apperad (instead of 8) – on the second page (“older posts”) everything’s displayed normal, but also the static page is listed there…

    • ill66 -

      back @home, i just tried again (several things – your modified code, changing the code line by line), but in both cases happens as follwos:
      on the first/homepage all postings disapear, which have no own date-line (i.e. all those, that have been publishes on a same day), on the second page all posts are still existent (also those with no date-line), inkl. the static page.
      if that may help…

      • Paul -

        Did you include the following on your homepage in your template:<b:include data='post' name='post'/>? This is what displays the posts.

        • ill66 -

          yes, i did, since i just pasted your abovementioned code…

          • Paul -

            Can you send me your full template code and I’ll have a look?

            • ill66 -

              when i use the XML-file you sent me (thx a lot), not only the static pages won’t disapear, but also many of the posts are displayed doubly.
              LOL mysterious….

              • Paul -

                Interesting. When I tested the template I didn’t see double-posting. The post information is displayed at the<b:include data='post' name='post'/> line. If this is repeated twice for any post then a post will be displayed twice.

Trackbacks/PingBacks

  1. [...] Hiding Static Pages from Homepage in Blogger [...]

Do you have something to say? Let everyone know!




CommentLuv Enabled