Blogger Notable Template - Post Pagination Fix or Replacement?

只愿长相守 提交于 2019-12-11 05:28:18

问题


The Blogger "Notable" template's post pagination link on the bottom of the main page only shows a "More Posts" link. It's missing a "Previous Posts". It's also missing the traditional "Home" link. The "More Posts" link correctly disappears on the last page of posts.

I am looking to enable at least a "Previous Posts" link.

This appears to be intentional on the part of Google as the code includes this:

<div class='blog-pager container' id='blog-pager'> <b:include cond='data:newerPageUrl' name='previousPageLink'/> <b:include cond='data:olderPageUrl' name='nextPageLink'/> <b:include cond='data:view.url != data:blog.homepageUrl' name='homePageLink'/></div>

But in two locations each the code includes:

<b:includable id='previousPageLink'><!-- Don't show --></b:includable>

<b:includable id='homePageLink'><!-- Don't show --></b:includable>

I attempted to fix this by first altering this line:

<a expr:href='data:blog.homepageUrl'>Home</a>

The only thing that did was the "Home" link to appear on the last page of posts where the "More Posts" previous was placed. Several other examples found online could not be tried as they refer to code that no longer exists within templates.

I've also tried at least a dozen 3rd party numbered pagination coding schemes which overwrite Blogger's existing code, but those do not work correctly.

Any idea of how to fix the template to enable the links or 3rd party code that might work?


回答1:


You will need to replace -

<b:includable id='previousPageLink'><!-- Don't show --></b:includable>

with

<b:includable id='previousPageLink'>
    <a class='blog-pager-newer-link flat-button ripple' expr:href='data:newerPageUrl' expr:title='data:messages.newerPosts'>
        <data:messages.newerPosts/>
    </a>
</b:includable>

and replace

<b:includable id='homePageLink'><!-- Don't show --></b:includable>

with

<b:includable id='homePageLink'>
    <a class='home-link flat-button ripple' expr:href='data:blog.homepageUrl' expr:title='data:messages.home' >
        <data:messages.home/>
    </a>
</b:includable>

to show the Previous Posts (now called Newer Posts) and Home button in the page navigation. Depending on theme being used, you will need to add custom CSS to make them appear correctly




回答2:


Thanks Prayag Verma! That Worked Great!

The "More Posts" link code was:

<b:includable id='nextPageLink'>
<a class='blog-pager-older-link flat-button ripple' expr:href='data:olderPageUrl' expr:title='data:messages.morePosts'>
<data:messages.morePosts/>
</a>
</b:includable>

I decided to replace the default text for both the older and newer links. Thus I replaced <data:messages.newerPosts/> with &#8592; Previous and I replaced <data:messages.morePosts/> with Next &#8594;.

I also added a border to make them stand out more. As this button class has a -8 margin the margin needed to be reset to 0 otherwise the two buttons next to each other would overlap. A 8px margin was then added to the Next button so they would not touch.

As this template uses a sticky menu at the top the Home button at the button was unnecessary so I hid it. The default top margin on the blog-pager was too much and was thus reduced.

The following code needed to be inserted just above the </body> tag:

<style>
.blog-pager a{
margin: 0px;
border: 1px solid #25a186;
}

.blog-pager a.blog-pager-older-link.flat-button.ripple{
margin-left: 8px;
}

.blog-pager a.home-link.flat-button.ripple{
display:none;
}

.blog-pager{
margin-top: 14px;
</style>


来源:https://stackoverflow.com/questions/44852609/blogger-notable-template-post-pagination-fix-or-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!