rel-tag-faq: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(Adding existing behavior summary to multi-word tag question)
Line 54: Line 54:


===Tags with file extensions===
===Tags with file extensions===
*Is <code><a rel="tag" href="http://example.com/cheese.htm">cheese</a></code> a valid tag, for "cheese"? Ditto <code>.asp</code> or <code>.php</code> variants? If not, why not?
*Is <code><a rel="tag" href="<nowiki>http://example.com/cheese.htm</nowiki>">cheese</a></code> a valid tag for "cheese"? Ditto ".asp" or ".php" variants? If not, why not?


No, you cannot use a tag URL with a file extension - unless you want the extension included in all of your tags. Explanation from Brian Suda on the microformats-discuss list:
Any file-name extension in the last path segment is part of the tag value:


--- the spec says:
*<nowiki>http://example.com/cheese.htm</nowiki> ⇒ cheese.htm
... the last segment of the path portion of the URI (after the final
*<nowiki>http://example.com/cheese.asp</nowiki> ⇒ cheese.asp
"/" character) contains the tag value.
*<nowiki>http://example.com/cheese.php</nowiki> ⇒ cheese.php


What that string is, is irrelavant. It could be /file/my.pdf and the
The [[rel-tag|rel-tag specification]] is clear on how to extract a tag from a URL. Special treatment for file-name extensions is not part of the extraction. Brian Suda gave an [http://microformats.org/discuss/mail/microformats-discuss/2007-February/008538.html explanation on the microformats-discuss list]. Consider the following URLs, the tags that the following URLs give under the current specification, and the effect of requiring special treatment for file-name extensions on the tags that the following URLs give.
tag would be "my.pdf" it could be /downloads/my.big.file.pdf and the
 
tag would be "my.big.file.pdf". A tag is everything after the last
*http://en.wikipedia.org/wiki/.htaccess
slash (unless the last char is a slash). So if that is a file or a
*http://en.wikipedia.org/wiki/.Net
folder, or a file that does not have an extention, or a folder that
*http://en.wikipedia.org/wiki/India.Arie
has a '.' in it's name.
*http://en.wikipedia.org/wiki/ASN.1
*[http://en.wikipedia.org/wiki/L.I.E. http://en.wikipedia.org/wiki/L.I.E.]


===What about Scope?===
===What about Scope?===

Revision as of 12:07, 14 April 2007

rel-tag frequently asked questions

This document serves to answer and discuss frequently asked questions specifically about the rel-tag microformat. You may want to read the rel-faq first as it answers many common questions about the HTML4 "rel" and "rev" attributes, and their linktype values. If you have a new question to ask, first consider asking on the microformats-discuss list.

Q&A

  1. Where does a tagging link belong? Does the tagging link only need to appear in my Web feed (RSS / Atom)? Does the tagging link need to appear on the page where my specific blog entry lies? Does the tagging link need to appear everywhere that I can possibly imagine?
    • In short, tagging links belong in all the places and formats in which you published tagged content. The Web page is the primary location where users read content and where search engines index. Thus the Web page is a place where you should absolutely include your rel-tag links. To tag your blog posts, put the rel-tag links inside them, visibly. The Web feeds are simply alternate ways of publishing your blog posts, and thus should include the full content of your blog posts, rel-tag links intact.
  2. Where shouldn't I use rel-tag?
  3. The format specifies that the tag must "come after the last / in the path". Will something like http://example.com/index.php/TAG work? Or does it have to be a "real" directory or mod_rewrite? -- singpolyma 23:51, 24 Jan 2006 (PST)
    • The key is the URL. Whether that URL is generated from a database or a directory does not matter. The URL matters.
      • My question, however, was about whether that URL form ( http://example.com/index.php/TAG ) would be valid, since there is the dot in "index.php".
        • Yes, the URL in the example is valid (or legal or conformant or whatever you want to call it to minimize confusion). The dot (period, full stop, U+002E) is free to appear in most places in a URL, even in the middle of a path-segment that is not the last path-segment. (The latest specification for URLs, "Uniform Resource Identifier (URI): Generic Syntax", is RFC 3986.)
  4. I'm developing a web application which uses tagging, and so of course I want to use rel-tag. For this application, I want nice, clean URLs. I was planning to use mod_rewrite to map a clean URL onto my underlying scripts. How do I use Apache's mod_rewrite to map http://example.org/~user/app/tag/car to http://example.org/~user/app/script.php?tag=car ?
    • One solution involves changing the script to inspect the path for the tag (via the variable "PATH_INFO"), rather than inspecting the query:
<Directory "/home/user/public_html/app/>
    RewriteEngine On
    RewriteRule ^tag/([^/]+)$ script.php/$1 [last]
</Directory>
    • For people who can edit the server's main configuration file, the following untested configuration code may work. Corrections are welcome.
RewriteEngine On
RewriteMap tag int:escape
RewriteRule ^/~user/app/tag/([^/]+)$ /~user/app/script.php?tag=${tag:$1} [last]
    • The following configuration code, left over from a previous contribution to this document, does a poor job according to tests. The following code fails to enforce the rel-tag rules about the tag corresponding to the last non-empty path-segment. The following code fails to transcode the tag for safe use in the URL query. Consider that a request on http://example.org/~user/app/tag/ would map internally to a request on http://example.org/~user/app/script.php?tag= . Consider that a request on http://example.org/~user/app/tag/not-a-tag/the-tag would map internally to a request on http://example.org/~user/app/script.php?tag=not-a-tag/the-tag . Consider that a request on http://example.org/~user/app/tag/the-tag/ would map internally to a request on http://example.org/~user/app/script.php?tag=the-tag/ . Consider that a request on http://example.org/~user/app/tag/attack&intent=destroy would map internally to a request on http://example.org/~user/app/script.php?tag=attack&intent=destroy .
<Directory "/home/user/public_html/app/>
    RewriteEngine On
    RewriteRule ^tag/(.*)$ script.php?tag=$1
</Directory>
  1. Does a rel tag still have meaning if the link redirects? If the HTTP server returns a 302 status code, does the rel-tag have meaning? Is there a formal rule that indexers should follow the link to the final, resolved destination? Or is there a formal rule that a rel tag should be ignored if URL of its link does not return a status code of 200?
    • ..next answer

CSS selector

  • How do you write a CSS selector for rel-tag?
    • a[rel~="tag"] { color: green }

Are tags case sensitive?

  • Are tags case sensitive. Is "Dog" the same tag as "dog" and "DOG"?
    • Awaiting answer

Multi-word tags

  • How should a multi-word tag be made? For instance, if using Wikipedia as a name space, a page about a Black Redstart (a bird) would be tagged Black_Redstart, with an underscore [1]. Is there any way of aliasing alternatives ("BlackRedstart", "Black-Redstart", etc.)? Is any particular format preferable?
    • Existing bevavior
      • delicious supports combined tags
      • flickr supports multi-word tags with spaces but collapses spaces when searching
      • ma.gnolia supports multi-word tags with spaces
      • technorati supports multi-word tags with spaces
    • Awaiting answer

Tags with file extensions

  • Is <a rel="tag" href="http://example.com/cheese.htm">cheese</a> a valid tag for "cheese"? Ditto ".asp" or ".php" variants? If not, why not?

Any file-name extension in the last path segment is part of the tag value:

  • http://example.com/cheese.htm ⇒ cheese.htm
  • http://example.com/cheese.asp ⇒ cheese.asp
  • http://example.com/cheese.php ⇒ cheese.php

The rel-tag specification is clear on how to extract a tag from a URL. Special treatment for file-name extensions is not part of the extraction. Brian Suda gave an explanation on the microformats-discuss list. Consider the following URLs, the tags that the following URLs give under the current specification, and the effect of requiring special treatment for file-name extensions on the tags that the following URLs give.

What about Scope?

Since rel-tag is a feature used in many other microformats, the question often arises: "What is the scope of the tag?" For instance, a rel-tag may appear inside of an xfolk xFolk entry and on first glance it may appear that the tag should only apply to that entry. However, current publishing practice seems to indicate anything appearing on a page is likely related to the content of the page. Therefore, the interpretation is that not only does the rel-tag apply its direct container but to all containers and to the document as a whole; it contains the xFolk entry. This is a departure from strict knowledge theory in favor of real-world usage.

As another example, you may link to your friend Joe with XFN and hCard, indicating in his categories that Joe is interested in swimming, which you loathe. Since the article is primarily about you and not about Joe's hobbies and because the rel-tag is inside an hCard, you may expect that the rel-tag does not apply to the document; however, the document does contain information about swimming, albeit tiny, namely that your friend likes it. In this way, rel-tag is binary: it indicates direction (yes or no) but not magnitude. This equivalent to a free-text search sans [tf-idf]; i.e. without a notion of term relevance.

The upshot of this is that rel-tags can have downward scope but not upward scope.

Related pages

The rel-tag specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. These thoughts, issues, and questions are kept in separate pages.