rel-tag-faq

(Difference between revisions)

Jump to: navigation, search
(Q&A)
(clean up indenting for better ToC)
Line 5: Line 5:
== Q&A ==
== Q&A ==
-
# ''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?''
+
=== Where does a tagging link belong? ===
-
#* 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.
+
*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?
-
# ''Where shouldn't I use rel-tag?''
+
** 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.
-
#* rel-tag expresses a particular relationship (a) between the page you are on and (b) the target of a link. If you're not asserting this relationship, don't use rel-tag. In particular:
+
=== Where shouldn't I use rel-tag? ===
-
#** don't use rel-tag in [http://en.wikipedia.org/wiki/Tag_cloud Tag Clouds]
+
* rel-tag expresses a particular relationship (a) between the page you are on and (b) the target of a link. If you're not asserting this relationship, don't use rel-tag. In particular:
-
#** don't use rel-tag to refer to the pages http://www.technorati.com/tag/xyz, http://del.icio.us/tag/xyz, http://www.flickr.com/photos/tags/xyz/ (and so forth) if you're not asserting "this page is tagged 'xyz'"
+
** don't use rel-tag in [http://en.wikipedia.org/wiki/Tag_cloud Tag Clouds]
-
# ''The format specifies that the tag must "come after the last / in the path". Will something like <code><nowiki>http://example.com/index.php/TAG</nowiki></code> work?  Or does it have to be a "real" directory or [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html mod_rewrite]? -- [[User:Singpolyma|singpolyma]] 23:51, 24 Jan 2006 (PST)''
+
** don't use rel-tag to refer to the pages http://www.technorati.com/tag/xyz, http://del.icio.us/tag/xyz, http://www.flickr.com/photos/tags/xyz/ (and so forth) if you're not asserting "this page is tagged 'xyz'"
-
#* The key is the URL. Whether that URL is generated from a database or a directory does not matter. The URL matters.
+
=== Path with a . in ===
-
#** My question, however, was about whether that URL form ( <code><nowiki>http://example.com/index.php/TAG</nowiki></code> ) would be valid, since there is the dot in "index.php".
+
*The format specifies that the tag must "come after the last / in the path". Will something like <code><nowiki>http://example.com/index.php/TAG</nowiki></code> work?  Or does it have to be a "real" directory or [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html mod_rewrite]? -- [[User:Singpolyma|singpolyma]] 23:51, 24 Jan 2006 (PST)
-
#*** 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, "[http://gbiv.com/protocols/uri/rfc/rfc3986.html Uniform Resource Identifier (URI): Generic Syntax]", is RFC 3986.)
+
** The key is the URL. Whether that URL is generated from a database or a directory does not matter. The URL matters.
-
# ''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 [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html mod_rewrite] to map a clean URL onto my underlying scripts. How do I use Apache's [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html mod_rewrite] to map <code><nowiki>http://example.org/~user/app/tag/car</nowiki></code> to <code><nowiki>http://example.org/~user/app/script.php?tag=car</nowiki></code> ?''
+
*** My question, however, was about whether that URL form ( <code><nowiki>http://example.com/index.php/TAG</nowiki></code> ) would be valid, since there is the dot in "index.php".
-
#* One solution involves changing the script to inspect the path for the tag (via the variable "PATH_INFO"), rather than inspecting the query:
+
**** 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, "[http://gbiv.com/protocols/uri/rfc/rfc3986.html Uniform Resource Identifier (URI): Generic Syntax]", is RFC 3986.)
 +
=== Using Apache mod_rewrite ===
 +
* ''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 [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html mod_rewrite] to map a clean URL onto my underlying scripts. How do I use Apache's [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html mod_rewrite] to map <code><nowiki>http://example.org/~user/app/tag/car</nowiki></code> to <code><nowiki>http://example.org/~user/app/script.php?tag=car</nowiki></code> ?''
 +
** One solution involves changing the script to inspect the path for the tag (via the variable "PATH_INFO"), rather than inspecting the query:
<pre><nowiki><Directory "/home/user/public_html/app/>
<pre><nowiki><Directory "/home/user/public_html/app/>
     RewriteEngine On
     RewriteEngine On
     RewriteRule ^tag/([^/]+)$ script.php/$1 [last]
     RewriteRule ^tag/([^/]+)$ script.php/$1 [last]
</Directory></nowiki></pre>
</Directory></nowiki></pre>
-
#* For people who can edit the server's main configuration file, the following untested configuration code may work. Corrections are welcome.
+
** For people who can edit the server's main configuration file, the following untested configuration code may work. Corrections are welcome.
<pre><nowiki>RewriteEngine On
<pre><nowiki>RewriteEngine On
RewriteMap tag int:escape
RewriteMap tag int:escape
RewriteRule ^/~user/app/tag/([^/]+)$ /~user/app/script.php?tag=${tag:$1} [last]</nowiki></pre>
RewriteRule ^/~user/app/tag/([^/]+)$ /~user/app/script.php?tag=${tag:$1} [last]</nowiki></pre>
-
#* 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 <code><nowiki>http://example.org/~user/app/tag/</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=</nowiki></code> . Consider that a request on <code><nowiki>http://example.org/~user/app/tag/not-a-tag/the-tag</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=not-a-tag/the-tag</nowiki></code> . Consider that a request on <code><nowiki>http://example.org/~user/app/tag/the-tag/</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=the-tag/</nowiki></code> . Consider that a request on <code><nowiki>http://example.org/~user/app/tag/attack&intent=destroy</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=attack&intent=destroy</nowiki></code> .
+
** 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 <code><nowiki>http://example.org/~user/app/tag/</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=</nowiki></code> . Consider that a request on <code><nowiki>http://example.org/~user/app/tag/not-a-tag/the-tag</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=not-a-tag/the-tag</nowiki></code> . Consider that a request on <code><nowiki>http://example.org/~user/app/tag/the-tag/</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=the-tag/</nowiki></code> . Consider that a request on <code><nowiki>http://example.org/~user/app/tag/attack&intent=destroy</nowiki></code> would map internally to a request on <code><nowiki>http://example.org/~user/app/script.php?tag=attack&intent=destroy</nowiki></code> .
<pre><nowiki><Directory "/home/user/public_html/app/>
<pre><nowiki><Directory "/home/user/public_html/app/>
     RewriteEngine On
     RewriteEngine On
     RewriteRule ^tag/(.*)$ script.php?tag=$1
     RewriteRule ^tag/(.*)$ script.php?tag=$1
</Directory></nowiki></pre>
</Directory></nowiki></pre>
-
<ol start="4">
+
=== Does a rel tag still have meaning if the link redirects? ===
-
<li>''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?''
+
* 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?''
-
* Only the linked URL is important. The document specified by the URL, including any HTTP headers it contains are irrelevant. The whole point of rel-tag is that user-agents can figure out the name of the tag from the URL without having to make a request for the page linked to. [[User:TobyInk|TobyInk]] 03:56, 10 Aug 2007 (PDT)
+
** Only the linked URL is important. The document specified by the URL, including any HTTP headers it contains are irrelevant. The whole point of rel-tag is that user-agents can figure out the name of the tag from the URL without having to make a request for the page linked to. [[User:TobyInk|TobyInk]] 03:56, 10 Aug 2007 (PDT)
-
</li>
+
=== rel-tag in Link elements===
-
</ol>
+
*What is the rationale of rel-tag not being allowed in link elements, as long as rel-category is? Shouldn't the two have similar behaviours?''
-
# ''What is the rationale of rel-tag not being allowed in link elements, as long as rel-category is? Shouldn't the two have similar behaviours?''
+
===CSS selector===
===CSS selector===

Revision as of 23:46, 29 June 2015

Contents

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

Where does a tagging link belong?

Where shouldn't I use rel-tag?

Path with a . in

Using Apache mod_rewrite

<Directory "/home/user/public_html/app/>
    RewriteEngine On
    RewriteRule ^tag/([^/]+)$ script.php/$1 [last]
</Directory>
RewriteEngine On
RewriteMap tag int:escape
RewriteRule ^/~user/app/tag/([^/]+)$ /~user/app/script.php?tag=${tag:$1} [last]
<Directory "/home/user/public_html/app/>
    RewriteEngine On
    RewriteRule ^tag/(.*)$ script.php?tag=$1
</Directory>

Does a rel tag still have meaning if the link redirects?

rel-tag in Link elements

CSS selector

Are tags case sensitive?

Multi-word tags

Tags with file extensions

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

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.

Encoding and decoding the tag text in JavaScript

If you want to get the text of the tag using JavaScript, you should use decodeURIComponent() to get a text representation of the tag, not escape. decodeURIComponent will properly handle UTF-8.

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.

rel-tag-faq was last modified: Wednesday, December 31st, 1969

Views