Sign in
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

canonical in pagination

  • This topic has 11 replies, 3 voices, and was last updated 9 months, 2 weeks ago by .
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #9899
    Avatar photolich2king

    Hello,

    I want to make pagination pages 2, 3, etc. to point canonical to main page.
    How can I do this ?

    Currently, I’ve only used the previous page as canonical. But I should point the canonical to the main url.

    {{#if @pagination}}
       {{#if @pagination.previousPage}}
          <link rel="canonical" href="{{@pagination.previousPageUrl }}" />
          <link rel="prev” href="{{@pagination.previousPageUrl }}">
       {{/if}}
       {{#if @pagination.nextPage}}
          <link rel="next" href="{{@pagination.nextPageUrl }}">
       {{/if}}
    {{/if}}

    Thank you.

    #9933
    Avatar photolich2king

    Any help on this ?

    Thanks.

    #9947
    Avatar photoitips3727

    Personally, I’ve found that by using the default settings in the Publii themes, the canonical URL takes care of itself so to speak.

    While I probably can’t help much with your particular problem but just in case you’re not aware, below is some additional information.

    If when you create and publish a post / web page, and allow search engines to index your web site, Publii automatically creates a canonical URL for you — providing noindex, nofollow are turned off (so indexing is turned on).

    If when you create your post, you have a different preferred canonical URL you would rather use, you can enter it into the ‘Canonical URL’ box. Your canonical URL then overrides the default canonical URL that would have applied otherwise.

    Refer to: https://getpublii.com/docs/adding-editing-and-deleting-posts.html#adding-editing-and-deleting-posts

    Under the subheading ‘Creating Your First Post’, refer to:

    Canonical URL – If your post is duplicate content from another part of your site, you can enter the original post’s URL here to prevent the duplicate content impacting your search ranking.

    Otherwise, for more customisation, maybe check out: https://getpublii.com/dev/canonicallink-helper/

    Perhaps others might be able to help if you can give more information about your theme, Publii version, etc.

    #9949
    Avatar photolich2king

    The issue is that {{canonicalLink}} doesn’t work properly in pagination, that’s why I’ve changed it. In my settings {{canonicalLink}} gives a broken url and it also doesn’t change to the main url in pagination.

    /preview/page/2/index.html => this page generated canonical url: preview/page/2/

    The above is wrong. It should generate to the main page and it should also have the index.html in it.

    The easiest fix it would be if I have a variable to the main page of pagination, similar to how @pagination.previousPageUrl generates the previous page, I need a variable to give me the first page.

    I’m using Sources theme on the latest publii version. But the theme doesn’t matter, as this is generated by the code.

    #9950
    Avatar photoitips3727

    @lich2king

    Okay. Since the Publii theme, Sources, is a premium theme, if your support period is still active, I suggest log into Publii Support and ask to get help from @Bob or @Tomasz.

    #9951
    Avatar photolich2king

    They won’t help in that support as it’s a bug of publii, not theme related. I’ve also had an issue before and they said to report publii bugs here or on git.

    #9954
    Avatar photoitips3727

    Okay. So if you’ve reported it on git, I guess monitor there and keep your fingers crossed.

    #9955
    Avatar photolich2king

    I didn’t yet. I will report on git as well. thanks

    #9959
    Avatar photoprivii

    I feel like I’m missing something. Why would you want page 2 canonical to point to the main page? They’re different pages with different content. The same canonical should only be used when the pages have the same content but different URLs.

    #9964
    Avatar photolich2king

    because they’re pagination generated pages, they should point only to the first page of the pagination. even if the listings are different, it’s bad for seo to have pagination pages indexed. so canonical just to the first one (of the pagination) is the best or to just have noindex on the other pages except first. the reason is for seo optimization. canonical can work also for similar pages, not just for duplicated pages. though, I can fix the issue with noindex.

    #9966
    Avatar photoitips3727

    @lich2king

    By default, it seems Publii strives to encourage us to make each URL unique and search engine friendly — and therefore, by default make the canonical URL version unique too. However, at the same time, we know that Publii includes the Canonical URL box, so we can override the default canonical URL at any time with another preferred version.

    So the default page for a series of related pages might have the URL form of https://www.examplesite.com/widget-one/ , using the Canonical URL box, you could if you wanted change that to have a canonical URL of https://www.examplesite.com/widget/ , while the main page link would still be https://www.examplesite.com/widget-one/ Though personally, I don’t see the point of needing to make a change like that since each page should be unique anyway, with it’s own default unique canonical URL.

    A check online seems to show quite a lot of conflicting ideas relating to how to deal with canonical paginated URLs — but most of those I’ve seen don’t apply as Publii already addresses the issues that seem to plague a lot of other website systems. Plus, of course there could be errors in guidelines too as some information goes out of date. Perhaps the best most reliable sources are Google, Bing, etc.

    Having said all that, I’m not sure if any of the following ideas will help you, but here goes anyway.

    I can imagine that for websites with lots of pagination canonical issues can be more challenging to deal with — especially if you have multiple pages with similar or ‘thin’ content.

    In addition, to using the ‘Canonical URL’ box in the SEO section of each post page / web page, two other solutions come to mind that don’t involve changing any code, and which might help contribute to resolve your problem:

    • Option A: make each page more unique: add more unique content to each ‘similar, thin content’ page / post.
    • Option B: use Publii’s existing commands to change the indexing instructions for pages with ‘thin content’.

    For Option B, presumably, your different pagination uses Publii tags.

    In Publii settings: Site Settings > Advanced Options > SEO > Tag page > Meta robots, usually Publii applies a default setting of nonindex, follow. This helps ensure that similar pages like /page2 or /page3 or /page4 don’t get indexed but can be followed by search engines.

    Also, in the same section, you can turn on or off ‘Disable tags pagination indexing’, to ensure your tags pagination files will either be included or excluded (depending on your choice) from the sitemap and will have the noindex, follow robots metatags added.

    Plus, in the same section, you can choose to turn on or off ‘Disable tags pagination’. When enable, tags pagination won’t be generated.

    #9971
    Avatar photolich2king

    I’ve got used to editing the theme.

    So I fixed it with noindex.

    {{#if @pagination}}
        {{#if @pagination.previousPage}}
      <meta name="robots" content="noindex">
            <link rel="prev" href="{{@pagination.previousPageUrl }}">
        {{/if}}
        {{#if @pagination.nextPage}}
            <link rel="next" href="{{@pagination.nextPageUrl }}">
        {{/if}}
    {{/if}}

    I’ve changed this in head.hbs. If the page is pagination and it has a previous page, I will mark it as noindex. So only the first pagionation page to be actually indexed, the other pages (2,3, etc) will be noindex.

    Thanks guys!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.