2010年12月2日 星期四

Layouts Data Tags 一文部份中譯




Layouts Data Tags 版面的資料標籤

 Widget Tags for Layouts 一文中曾提過 data tags 有非常多的種類. 他們的格式一般寫成<data:name/> 或 <data:name1.name2/>,  
name 是data 的名稱 ,
寫成 name1.name2 時, name2 是包含在集合name1裏的一個 data標籤 , 像. photo.url.

不同的面元素( page element )頁 又包含了不同的widget,
所以主要分成了下列這些可用的資料標籤(data tag)

Globally Available Data 全域資料
這些data值全部網頁都可以使用, 不像其它的data只能用在特定的widget. 但是前面要冠上blog字串 <data:blog.title/>, etc.
  • title: The blog's title. 部落格的標題 <data:blog.title>=
  • pageType: 正在瀏覽的頁面之種類. 有 'item', 'archive', 或 'index'.

    ************************************************************************
    在判別式中舉例:
    <
    b:if cond='data:blog.pageType == "item"'>
     
    item是表示目前頁面在內文
    <b:if cond='data:blog.pageType == "archive"'> 目前頁面在歷史文章列表 
    <b:if cond='data:blog.pageType == "index"'> 目前頁面在分類標籤列表 不是首頁!!
    <b:if cond='data:blog.homepageUrl == data:blog.url'> 目前在首頁

    ************************************************************************


  • url: 現處頁面的網址.
  • homepageUrl: blog的home網址.
  • pageTitle: 現處頁面的標題. 通常就是指 blog title, 但在某種頁面 像是archive或post中,還有出現更多的資訊
  • encoding: blog的編碼方式, e.g. UTF-8.
  • languageDirection: 排列是 由左到右 或 由右到左
  • feedLinks: Page header 自動的 feed links 
Back to the top.

頁面標題 Page Header
僅僅有兩種簡單的標題  <data:title/> 跟 <data:description/>.
  • title:  blog's 標題.
  • description:  blog's 描述.
Back to the top.

部落格文章 Blog Posts


像每個部落格一樣 ,這邊是部落格裏 最中心同樣也最複雜的部份,你應該在撰文之前小心而且小動作的修改模版, 當你真的要修改這個部份,下面提到的data都是在這個widget中可用的

  • feedLinks: 本頁面的 feeds
    在主頁面 , 這就是主要的blog feeds
    在內文(item)頁面 ,這就是包含了comment的 feeds
    每一個item都包含了下列的tag

    • url: The feed URL.
    • name: The feed name (i.e. 'Posts' or 'Comments').
    • feedType: The type of feed (Atom or RSS).
    • mimeType: The mime type of the feed.

  • olderPageUrl: 如果有頁面比現在的頁面還要舊的文章, 這個tag就是這些舊文章的網址. (並非所有的頁面種類都有這樣的tag)

  • olderPageTitle: 舊文章的標題.
  • newerPageUrl: 新文章的網址.
  • newerPageTitle: 舊文章的標題.
  • commentLabel: The phrase to use to show the number of comments, e.g. "comments."
  • authorLabel: 文章的作者, e.g. "posted by."
  • timestampLabel: 撰文的時間, e.g. "posted at."
  • postLabelsLabel: 文章的 labels標籤, e.g. "labels for this post."
  • backlinksLabel: Phrase to describe backlinks to this post, e.g. "links to this post."
  • posts: 所有文章的列表.每篇文章還包含了下列的部份:
    • dateHeader: 文章的時間, 今天的文章如果不止一篇 只Po在第一篇裏
    • id: post ID.
    • title: 標題.
    • body: 內容.
    • author: 作者.
    • url: The permalink of this post.
    • timestamp: 文章的時間, 跟 dateHeader 不同, 每一篇文章都有時間戳記.
    • labels: 所有文章的label.每個label包含:
      • name: 名稱.
      • url: 所有相同label的文章. 的網址
      • isLast: True or false. 這個label是不是在列表中的最後一個 (useful for placing commas).
    • allowComments: 'True' if this post allows comments.
    • numComments: The number of comments on this post.
    • showBacklinks: Whether to show backlinks for this post.
    • numBacklinks: Number of backlinks for this post.
    • addCommentUrl: The URL of the 'add a comment' form for this post.
    • emailPostUrl: The URL of the 'email this post' form for this post.
    • editUrl: The URL of the edit form for this post.
    • feedLinks: A list of feeds specific to this post. (This is different from the overall blog feedLinks, as it may contain a feed for the post's comments, for instance.) Each contains the following:
      • url: The feed URL.
      • name: The feed name (e.g. 'Posts' or 'Comments').
      • feedType: The type of feed (Atom or RSS).
      • mimeType: The mime type of the feed.
    • comments: A list of all comments for this post (on item pages only). Each contains the following:
      • id: The numeric ID of the comment.
      • body: The body of the comment.
      • timestamp: The time the comment was created.
      • author: The display name of the comment's author, or 'Anonymous'.
      • authorUrl: URL of the comment author's profile, if the comment is not anonymous.
      • deleteUrl: The URL for deleting this comment.
      • isDeleted: Whether this comment has been deleted. (The text of deleted comments is replaced with a placeholder.)
Back to the top.

部落格的存檔文章 Blog Archives






The different styles provided here are for the different default options on the Page Elements tab. If you're designing a new version, it's easiest to use 'FLAT' as the style, and then manipulate the rest of the data as desired.
  • title:  widget 標題.
  • style: 顯示種類 'MENU', 'FLAT', or 'HIERARCHY'.
  • data: A list of each archive unit, each of which contains:
    • name: 名稱是以時間間隔為單位, 像是 "August 2006."
    • url: 包含這段時間所有的文章的Link.
    • post-count: 這段時間有多少篇文章.
Back to the top.

個人資訊 Profile Widget




For a blog with a single author, the profile widget contains the following information. Note that to access different parts of the photo data, you'll use notation such as<data:photo.url/>.
  • title: The title of the widget.
  • userUrl: The author's profile URL.
  • location: The location from the author's profile.
  • aboutme: The "About Me" information from the profile.
  • displayname: The author's display name.
  • photo: The user's profile photo, made up of the following:
    • url: The photo URL.
    • width: The photo's width, in pixels.
    • height: The photo's height, in pixels.
    • alt: The "alt" text for the photo.
On team blogs, the profile widget contains less information about more authors, as follows.
  • title: The title of the widget.
  • authors: The list of all authors, each of which contains the following:
    • displayname: The author's display name.
    • userURL: The author's profile URL.
If you want to design your template to handle both single- and multiple-author blogs, you can use the data:team variable to distinguish between the two cases. E.g. <b:if cond='data:team=="true"'> (display multiple authors) </b:if>
Back to the top.

Text / HTML / JavaScript Widget
The Text widget and the HTML/JavaScript widget work the same way and have the same two pieces of data.
  • title: The widget's title.
  • content: The content of the widget.
Back to the top.

Feed Widget
A feed widget's content is dynamically loaded using Google AJAX API after blog is rendered in a browser. It can be styled only using CSS.
  • title: The widget's title.
  • feedUrl: The URL of the feed.
Back to the top.

Picture Widget
A picture widget contains a single image, and provides all the relevant data for that image.
  • title: The title of the widget.
  • sourceUrl: The URL of the image.
  • width: The image's width, in pixels.
  • height: The image's height, in pixels.
  • caption: The image caption.
Back to the top.

Labels Widget
The labels widget includes a list of all labels that are in use on the blog.
  • title: The widget title.
  • labels: The list of labels, each of which contains:
    • name: The text of the label.
    • count: How many posts have this label.
    • url: A link to a page displaying posts with this label.
Back to the top.

List Widget
The simplest form of a list. Each item is just a single piece of text, without any different types of data within it.
  • title: The widget title.
  • items: The list of items.
Back to the top.

Link List Widget
A slightly fancier list, where each item has two parts to it: the text and the link.
  • title: The widget title.
  • links: The list of links, each of which contains:
    • name: The link's text.
    • target: The link's URL.
Back to the top.

Logo Widget
It doesn't get any simpler than this one. Just one piece of data here.
  • fullButton: The URL of the Blogger button you've selected.
Back to the top.


原文所在: http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=47270

用  ******** 包住的不是原文 只是助憶跟舉例用 .

沒有留言:

張貼留言

web analytics