CouchDB URL Rewriting for SEO
I'm trying to create an entire site hosted purely on CouchDB (no nginx
reverse proxy either) using a lot of client side Jquery/AJAX magic. Now
I'm in the process of making it SEO friendly. I'm using vhosts and URL
rewrites to route traffic from the root to my index.html file:
vhost:
example.com /dbname/_design/dd/_rewrite/
In my rewrite definition:
rewrites:[
{
"from": "/db/*",
"to": "/../../../*",
"query": {
}
},
{
"from": "/",
"to": "../../static/index.html",
"query": {
}
}
]
When optimizing a site for SEO, Google requires you to do a few things:
Use the hashbang (#!) in your friendly URL to tell the web crawler that
you are an AJAX site with web crawlable material:
http://example.com/index.html#!home
Use an http query argument to provide an HTML escaped fragment of that
AJAX page: http://example.com/index.html?_escaped_fragment=home
I tried the following with no luck:
rewrites:[
{
"from": "/db/*",
"to": "/../../../*",
"query": {
}
},
{
"from": "/",
"to": "../../static/index.html",
"query": {
}
}, /* FIRST ATTEMPT */
{
"from": "/?_escaped_fragment=:_escaped_fragment",
"to": "/_show/escaped_fragment/:_escaped_fragment",
"query": {
}
}, /* SECOND ATTEMPT */
{
"from": "/?_escaped_fragment=*",
"to": "/_show/escaped_fragment/*",
"query": {
}
}, /* THIRD ATTEMPT */
{
"from": "/",
"to": "/_show/escaped_fragment/:_escaped_fragment",
"query": {
}
}
]
From what I've seen, CouchDB's URL rewriter is not capable of
distinguishing the difference between a URLs with args and no args. Has
anyone had luck creating such a rule with CouchDB URL rewrites?
No comments:
Post a Comment