rel-tag-faq

(Difference between revisions)

Jump to: navigation, search
(mod_rewrite examples; URL syntax clarification; typographical, hypertextual, and editorial niceties)
(RewriteRule correction)
Line 15: Line 15:
<pre><nowiki><Directory "/home/user/public_html/app/>
<pre><nowiki><Directory "/home/user/public_html/app/>
     RewriteEngine On
     RewriteEngine On
-
     RewriteRule ^~user/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.

Revision as of 13:55, 24 March 2006

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. 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.)
  3. 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. ...next question
    • ..next answer
rel-tag-faq was last modified: Wednesday, December 31st, 1969

Views