2016-09-06 53 views
0

我有一個博客用Photoshop教程和因爲一些我的教程是相當長的,我決定分家的內容分成部分如何設置2部分博客條目的規範URL?

http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx 

http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?part=2 

canonical相對的兩個頁面設置爲

http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx 

這是否比有2個規範鏈接的選項更好?請注意,我在我希望編入索引的兩個部分都有圖像和文字。

回答

0

在這種情況下,不允許使用鏈接類型canonical

RFC 6596 defines

目標(規範)IRI必須標識內容要麼是重複或在上下文中(指)IRI的內容的超集。

但是您的第二頁不包含在(或與第一頁相同)。

所以,你有以下這些選項:

  • 引入包含整個內容的頁面,使這一個canonical目標爲所有分頁頁面(但如果你這樣做,你可能要考慮停止首先提供分頁版本)。請注意,只有分頁don’t have separate user comments(或任何其他獨特內容)才允許使用。
  • 使用self-referentialcanonical目標。
  • 忽略canonical
0

您可以使用規範的分頁的解決:

  1. 在第一頁的<head>部分(www.psd-dude.com/tutorials/how-to-make-a-咖啡漬文本功能於photoshop.aspx), 添加一個鏈接標籤指向下一個頁面序列中,像這樣的:

    <link rel="canonical" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx"> 
    <link rel="next" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?part=2"> 
    

    因爲這是序列中的第一個URL,就沒有必要爲rel =「prev」添加標記。

  2. 在第二和第三頁上,添加指向序列中前一個和下一個URL的鏈接。例如,可以添加如下處理序列的第二頁:

    <link rel="prev" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx"> 
    <link rel="canonical" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?part=2"> 
    <link rel="next" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?part=3"> 
    
  • 在序列的最後一頁(www.psd- dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?部分= 4>),添加指向先前的URL的鏈接,就像這樣:

    <link rel="prev" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?part=3"> 
    <link rel="canonical" href="http://www.psd-dude.com/tutorials/how-to-make-a-coffee-stain-text-in-photoshop.aspx?part=4"> 
    

    因爲這是序列中的最後一個網址,因此無需添加一個rel =「下一個」鏈接。