Showing posts with label blogger. Show all posts
Showing posts with label blogger. Show all posts

在 Blogger 中指定 meta tag 給特定網頁的方式及應用

20 February, 2009

給網頁指定獨立的 Meta Tag


Meta Tag 對於網頁搜尋的排名有幫助,但 blogger 無法針對個別網頁指定 Meta Tag。如果是直接寫進 Template 中,整個網站的網頁都會被標誌上相同的關鍵字,這樣會被認為是 Spam。
下面介紹的是利用邏輯判斷網址,再決定要不要貼上 Meta Tag。所以,只有網頁被寫出來之後,才能進入 Template 中替網頁加上 Meta Tag。

在 Template 的 Edit Html 中,先找到下列的code:

<b:include data='blog' name='all-head-content'/>


加入以下程式碼:

<b:if cond='data:blog.url == "請換上要套上下列敘述及關鍵字的網頁網址"'>
<meta content='請換上您的網站敘述' name='description'/>
<meta content='請換上您的關鍵字' name='keywords'/>
</b:if>


範例如下:
<b:include data='blog' name='all-head-content'/>

<b:if cond='data:blog.url == "http://kienhock.blogspot.com/2008/01/blog-post_2128.html"'>
<meta content='在生活中和陌生人的短暫接觸,有時我們對彼此的感覺是如此的好。 那時留下的照片,就好像我在那當下如同朋友般面對著妳。 再看看那照片,我們算是認識了的吧!' name='description'/>
<meta content='婚禮紀錄, 婚攝, 台北' name='keywords'/>
</b:if>
<b:if cond='data:blog.url == "http://kienhock.blogspot.com/2008/07/kuching-hidden-paradise-of-borneo.html"'>
<meta content='古晉街景的一大特色就是隨處都可以看到樹,路旁都種滿了行道路。在古晉,隨處都可見火焰木。此樹的花呈火紅色,在花盛開時,整棵樹都佈滿了火紅色的花。遠處看去,就像是正在飄揚的蠟燭火焰。 ' name='description'/>
<meta content='古晉旅遊, 遊記, 地圖' name='keywords'/>
</b:if>


利用 Meta Tags 取代 robots.txt 來阻擋某些網頁被擷取

Blogger 的 robots.txt 沒辦法被修改,所以就沒辦法用 robots.txt 來阻擋一些網頁被 搜尋引擎 來訪。但是,我們可以用 meta tag 的 robots 中的 NOINDEX 指令來做到相同的工作。

下方的例子以阻擋掉 2008年9月份的 備份網頁為例(http://kienhock.blogspot.com/2008_09_01_archive.html)。
<b:if cond='data:blog.url == "http://kienhock.blogspot.com/2008_09_01_archive.html"'>
<meta content='NOINDEX' name='ROBOTS'/>
</b:if>


阻擋掉備份網頁的擷取可以有效排除網站的重覆資料。像 Blogger 的 robots.txt 的預設值中就排除掉 tags 的搜尋。


參考文章:





延伸閱讀:


在檢視 blogger 標籤時,如何顯示大於預設值的 20筆資料

10 February, 2009

如果在 Blogger 中,按下 labels ,預設值就只會顯示20筆資料。
但如果在網址後面加上 "?max-results=100" 就可以把這預值數值改變,如下(You can just add "?max-results=100") at the url to expand the maximum number of the result show, here is the syntax:
http://kienhock.blogspot.com/search/label/%E7%A0%82%E6%8B%89%E8%B6%8A?max-results=100

要修改這個很簡單(it is very simple to tweak this)。

layout -> Edit HTML -> checked advanced mode

search for

a expr:dir='data:blog.languageDirection' expr:href='data:label.url'

replace it with the following syntax:

a expr:dir='data:blog.languageDirection' expr:href='data:label.url + "?max-results=1000"'

在blogger 的標籤檢視中加上清單列表

25 August, 2008

list of label

列出 標籤的清單
上圖是用在我的部落格的標籤清單,下方則是列出內文。



為了讓部落格在閱讀上更好找文章,我一直在找好用的方式。上一篇的 "其他我有在用的 widget" 中有介紹 Beautiful Beta 所寫的目錄表單。但使用上還是覺得不是很實用,最大的困擾是每一篇文章都要載入這模組,而且很耗資源,讓網站變得很慢。上星期花了點時間給 label 或 月份文章列表 加上清單。只有在點選 標籤 列表時才會載入,這樣就很省資源,而且蠻清楚。

進入到:
Control panel -> Layout -> edit Html -> Expand Widget Templates

找到下列的碼:

<b:include data='top' name='status-message'/>

<data:adStart/>



插入以下的碼:


<!-- Start of post list -->
<b:if cond='data:blog.homepageUrl!= data:blog.url'>
<b:if cond='data:blog.pageType != "item"'>
&#60;div class='labelwrap'&#62;
&#60;div class='labelbg'&#62;

</b:if>
</b:if>
<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.homepageUrl!= data:blog.url'>
<b:if cond='data:blog.pageType != "item"'><a expr:href='data:post.url'><data:post.title/></a><br></b:if>
</b:if>
</b:loop>
<b:if cond='data:blog.homepageUrl!= data:blog.url'>
<b:if cond='data:blog.pageType != "item"'>
&#60;/div&#62;
&#60;/div&#62;

<b:include name='nextprev'/>
</b:if>
</b:if>

<!-- End of post list -->



在來則是加入 css,在 <head></head> 之間插入下面的碼:


/* Status css-source http://bloggermagz.blogspot.com/2007/09/customize-your-blogger-status-message.html */
#main .labelwrap {
width:90%;
padding:5px 5px 5px 5px;
margin-top:10px;
margin-left:10px;
background: #FFF9B3 ;
border:1px solid gold;
}

#main .labelbg {
background: #FFF9B3 ;
}



這樣就完成了。

延伸閱讀:

修改 blogger template將單一文章標題的超連結給移除及其他我有在用的 widget

02 August, 2008

  • 把blogger中標題的 link 給移除(remove the hyperlink at single post of blogger)

  • 在單一頁面中,blogger 還是在文章標題中做上超連結。我不是很喜歡,所以把它處理掉了。這也是我第一次研究自己修改 blogger 版面,因為到處都找不到要怎麼移除。Control panel -> Layout -> edit Html -> Expand Widget TemplatesFind for the following section:

    <b:includable id='post' var='post'><div class='post hentry'><a expr:name='data:post.id'/><b:if cond='data:post.title'><h3 class='post-title entry-title'><b:if cond='data:post.link'><a expr:href='data:post.link'><data:post.title/></a><b:else/><b:if cond='data:post.url'><a expr:href='data:post.url'><data:post.title/></a><b:else/><data:post.title/></b:if></b:if></h3></b:if><div class='post-header-line-1'/>

    Put the following code after "<div class='post hentry'> ":

    <b:if cond='data:blog.pageType != "item"'>

    and also put the following code before " <div class='post-header-line-1'/> ":

    <b:else/><h3 class='post-title entry-title'><data:post.title/></h3></b:if>

    Here is the complete code:

    <b:includable id='post' var='post'><div class='post hentry'><b:if cond='data:blog.pageType != "item"'><a expr:name='data:post.id'/><b:if cond='data:post.title'><h3 class='post-title entry-title'><b:if cond='data:post.link'><a expr:href='data:post.link'><data:post.title/></a><b:else/><b:if cond='data:post.url'><a expr:href='data:post.url'><data:post.title/></a><b:else/><data:post.title/></b:if></b:if></h3></b:if><b:else/><h3 class='post-title entry-title'><data:post.title/></h3></b:if><div class='post-header-line-1'/>

  • 以標籤(label) 做分類

  • 先看一下我在 婚禮紀錄網站 如何使用這個 Hactro 提供的 widget:婚禮記錄網站我把這個 widget 配置在 sidebar,當做 目錄來使用。怎麼安裝請連到 Hactro 網站去看:Hoctro's Place: Showing Your Contents By Blogger's Labels

後來我覺得這個工具很佔資源,網頁 loading會被拉慢,我還是大部份改回用 Link widget。只是不適用在我的方法。




  • 目錄表單



  • Table of Contents,我是參照 Beautiful Beta 的 widget 設置,可以參考這:
    http://beautifulbeta.blogspot.com/2007/04/blogtoc-widget-released.html


  • 給網頁指定獨立的 Meta Tag



  • 請參考:在 Blogger 中指定 meta tag 給特定網頁的方式及應用


    延伸閱讀:


    熱情推薦:

    關於作者

    My Photo
    Ahock
    在台灣過著古晉人的生活,算是滯留台灣10多年了~ ps:這邊放的照片是我的母親梅花。
    View my complete profile
    Visitors
    since 06 March 2008
    網站日誌

      © Blogger templates Newspaper II by Ourblogtemplates.com 2008

    Back to TOP