cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblot...@apache.org
Subject [2/2] docs commit: Refactoring redirects a bit and improving their docs.
Date Tue, 12 Apr 2016 02:44:39 GMT
Refactoring redirects a bit and improving their docs.


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/3b366ea6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/3b366ea6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/3b366ea6

Branch: refs/heads/master
Commit: 3b366ea6c3a63b2641b3a3f71d5d76902e36e00c
Parents: d002c4b
Author: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Authored: Mon Apr 11 19:44:27 2016 -0700
Committer: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Committed: Mon Apr 11 19:44:27 2016 -0700

----------------------------------------------------------------------
 README.md               |   4 +-
 www/.htaccess           | 100 ++++++++++++++++++++++++++++---------------
 www/_data/redirects.yml |  39 +++++++++++------
 3 files changed, 94 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/3b366ea6/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 18c5f86..718f79d 100644
--- a/README.md
+++ b/README.md
@@ -155,7 +155,7 @@ Alternatively, to dynamically rebuild the site and refresh the browser
_when cha
 
     node_modules/.bin/gulp watch
 
-## Redirects
+## Docs Redirects
 
 Sometimes docs pages get removed, renamed, and added. There is [a file][redirects] that contains
redirects for such occasions. It has three sections:
 
@@ -168,7 +168,7 @@ For non-docs URIs, there are no versioning considerations. Make redirects
like s
     general:
         - {old: "old/uri/for/page.html", new: "its/new/uri.html"}
 
-**NOTE**: Review (and test, if possible) these redirects before making them live, since they're
permanent (HTTP 302) redirects. Incorrect permanent redirects will make a URI very hard to
bring back into browsers and search indices.
+**NOTE**: Review (and test, if possible) these redirects before making them live, since they're
permanent (HTTP 301) redirects. Incorrect permanent redirects will make a URI almost impossible
to bring back into browsers and search indices.
 
 There are five cases of changing URIs:
 

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/3b366ea6/www/.htaccess
----------------------------------------------------------------------
diff --git a/www/.htaccess b/www/.htaccess
index f5be91b..7174d4b 100644
--- a/www/.htaccess
+++ b/www/.htaccess
@@ -1,6 +1,22 @@
 ---
 ---
 
+###############################################################################
+# WARNING
+###############################################################################
+# Only modify this file if you know what you're doing. This file has
+# the potential to make pages become PERMANENTLY UNREACHABLE. If in
+# doubt, refer to these links:
+#
+# RewriteRule       - http://httpd.apache.org/docs/current/mod/mod_rewrite.html
+# RewriteRule flags - http://httpd.apache.org/docs/current/rewrite/flags.html
+# .htaccess tester  - http://htaccess.madewithlove.be/
+#
+# And remember: three-oh-ONE (301) menas you get ONE chance to get it right;
+#               three-oh-TWO (302) means you get TWO chances.
+###############################################################################
+
+# set error pages
 ErrorDocument 404 {{site.baseurl}}/404.html
 
 # turn off automatic directory indices
@@ -11,65 +27,79 @@ Options +FollowSymLinks
 RewriteEngine on
 
 # NOTE:
-#       Some of the below redirects are 302s, and some are 301s. 302s are used
-#       for redirects whose targets change sometimes. For example:
-#           - /docs/          -> /docs/fr/, /docs/en/, etc.
-#           - /docs/en/       -> /docs/en/dev/, /docs/en/latest/, etc.
-#           - /docs/en/latest -> /docs/en/4.0.0/, /docs/en/5.0.0/, etc.
-#
-#       301s are for PERMANENT redirects. These are used only for mapping old
-#       pages to new pages.
-
+#      Some of the below redirects are 302s, and some are 301s. 302s are used
+#      for redirects whose targets change sometimes. For example:
+#          - /docs/          -> /docs/fr/, /docs/en/, etc.
+#          - /docs/en/       -> /docs/en/dev/, /docs/en/latest/, etc.
+#          - /docs/en/latest -> /docs/en/4.0.0/, /docs/en/5.0.0/, etc.
+#
+#      301s are for PERMANENT redirects. These are used only for mapping old
+#      pages to new pages.
+#
 # NOTE:
-#      (\w\w(?:-\w\w)?) is the regex for versions
+#      (\w\w(?:-\w\w)?)                   - regex for languages
+#      (?:\d+\.(?:\d+\.\d+|x))|dev|latest - regex for versions
+#
+# NOTE:
+#      L  - terminal rule
+#      R  - redirect (followed by code)
+#      NE - no escaping special characters
 
-# 302 (temp):
-#       docs/          -> docs/[default language]/latest/
-#       docs/XX        -> docs/XX/latest/
-#       docs/XX/       -> docs/XX/latest/
-#       docs/XX/latest -> docs/XX/latest/
+# 302 (temporary):
+#
+#     docs/         -> docs/[default language]/latest/
+#     docs/*        -> docs/*/latest/
+#     docs/*/       -> docs/*/latest/
+#     docs/*/latest -> docs/*/latest/
+#
 RewriteRule ^.*docs/$ {{site.baseurl}}/docs/{{site.language}}/latest/ [R=302,L]
 RewriteRule ^.*docs/(\w\w(?:-\w\w)?)$ {{site.baseurl}}/docs/$1/latest/ [R=302,L]
 RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/$ {{site.baseurl}}/docs/$1/latest/ [R=302,L]
 RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/latest$ {{site.baseurl}}/docs/$1/latest/ [R=302,L]
 
-# 301 (perm):
-#       docs/XX/edge    -> docs/xx/edge/
-#       docs/XX/edge/YY -> docs/xx/dev/YY
-RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/edge$ {{site.baseurl}}/docs/$1/edge/
-RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/edge/(.*)$ {{site.baseurl}}/docs/$1/dev/$2 [R=301,L]
-
-# 301 (perm):
-#       docs version renames
-RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/6.0.0/(.*)$ {{site.baseurl}}/docs/$1/6.x/$2 [R=301,L]
+# 302 (temporary):
+#
+#     docs/*/XX/* -> docs/*/YY/*
+#
+{% for redirect in site.data.redirects.version-renames %}RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/{{redirect.old}}/(.*)$
{{site.baseurl}}/docs/$1/{{redirect.new}}/$2 [R=302,L]
+{% endfor %}
 
-# 302 (temp):
-#       docs language renames
-RewriteRule ^.*docs/zh/((?:\d+\.(?:\d+\.\d+|x))|dev|latest)/(.*)$ /docs/zh-tw/$1/$2 [R=302,L]
+# 302 (temporary):
+#
+#     docs/XX/* -> docs/YY/*
+#
+{% for redirect in site.data.redirects.language-renames %}RewriteRule ^.*docs/{{redirect.old}}/((?:\d+\.(?:\d+\.\d+|x))|dev|latest)/(.*)$
{{site.baseurl}}/docs/{{redirect.new}}/$1/$2 [R=302,L]
+{% endfor %}
 
-# 301 (perm):
-#       old docs pages -> new docs pages (global)
+# 301 (PERMANENT):
+#
+#     old docs pages -> new docs pages (global)
 #
 # NOTE:
 #       The first part of the path (i.e. the ".*") is thrown away and replaced
 #       by site.baseurl. It is thrown away because there is no RewriteCond to
 #       control whether the rewrite happens to a URI or a local file path
 #       (when Apache is locating the local file to serve).
-{% for redirect in site.data.redirects.docs-global %}RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/([^/]+)/{{redirect.old}}$
{{site.baseurl}}/docs/$1/$2/{{redirect.new}} [NE,R=301,L]
+{% for redirect in site.data.redirects.docs-global %}RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/((?:\d+\.(?:\d+\.\d+|x))|dev|latest)/{{redirect.old}}$
{{site.baseurl}}/docs/$1/$2/{{redirect.new}} [NE,R=301,L]
 {% endfor %}
 
-# 301 (perm):
-#       old docs pages -> new docs pages (version-specific)
+# 301 (PERMANENT):
+#
+#     old docs pages -> new docs pages (version-specific)
+#
 {% for redirect in site.data.redirects.docs %}RewriteRule ^.*docs/(\w\w(?:-\w\w)?)/{{redirect.old}}$
{{site.baseurl}}/docs/$1/{{redirect.new}} [NE,R=301,L]
 {% endfor %}
 
-# 301 (perm):
-#       old pages -> new pages
+# 301 (PERMANENT):
+#
+#     old pages -> new pages
+#
 {% for redirect in site.data.redirects.general %}RewriteRule ^.*/{{redirect.old}}$ {{site.baseurl}}/{{redirect.new}}
[NE,R=301,L]
 {% endfor %}
 
 # rewrite only:
-#       /docs/XX/latest/* -> /docs/XX/Y.Y.Y/*
+#
+#     /docs/XX/latest/* -> /docs/XX/Y.Y.Y/*
 #
 # NOTE:
 #       This does NOT return a redirect. It returns the resource *as if* the

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/3b366ea6/www/_data/redirects.yml
----------------------------------------------------------------------
diff --git a/www/_data/redirects.yml b/www/_data/redirects.yml
index 88beb52..e2e2a21 100644
--- a/www/_data/redirects.yml
+++ b/www/_data/redirects.yml
@@ -1,28 +1,43 @@
 # WARNING:
-#         these are *string-only* redirects; regexes will NOT work
+#         these are *string-only* redirects; do NOT use regexes
 
-# redirects paths relative to /
+# 302 (temporary) renames of versions
+version-renames:
+    - {old: "edge", new: "dev"}
+    - {old: "6.0.0", new: "6.x"}
+
+# 302 (temporary) renames of languages
+language-renames:
+    - {old: "zh", new: "zh-tw"}
+
+# 301 (PERMANENT) redirect paths relative to /
 general:
     - {old: "plugins/authors.html", new: "docs/en/latest/guide/hybrid/plugins/index.html#publishing-plugins"}
 
-# redirects paths relative to /docs/XX/
+# 301 (PERMANENT) redirect paths relative to /docs/XX/
 docs:
     - {old: "dev/guide/platforms/android/tools.html", new: "dev/guide/platforms/android/index.html"}
-    - {old: "dev/guide/platforms/android/lifecycle.html", new: "dev/guide/platforms/android/index.html#lifecycle-guide"}
-    - {old: "dev/guide/platforms/android/config.html", new: "dev/config_ref/index.html"}
-    - {old: "dev/guide/platforms/ios/tools.html", new: "dev/guide/platforms/ios/index.html"}
-    - {old: "dev/guide/platforms/ios/config.html", new: "dev/config_ref/index.html"}
-    - {old: "dev/guide/platforms/win8/packaging.html", new: "dev/guide/platforms/win8/index.html#signing-an-app"}
-    - {old: "dev/guide/platforms/win8/win10-support.html", new: "dev/guide/platforms/win8/index.html"}
-    - {old: "dev/cordova/plugins/pluginapis.html", new: "deprecated.html"}
-
     - {old: "latest/guide/platforms/android/tools.html", new: "latest/guide/platforms/android/index.html"}
+
+    - {old: "dev/guide/platforms/android/lifecycle.html", new: "dev/guide/platforms/android/index.html#lifecycle-guide"}
     - {old: "latest/guide/platforms/android/lifecycle.html", new: "latest/guide/platforms/android/index.html#lifecycle-guide"}
+
+    - {old: "dev/guide/platforms/android/config.html", new: "dev/config_ref/index.html"}
     - {old: "latest/guide/platforms/android/config.html", new: "latest/config_ref/index.html"}
+
+    - {old: "dev/guide/platforms/ios/tools.html", new: "dev/guide/platforms/ios/index.html"}
     - {old: "latest/guide/platforms/ios/tools.html", new: "latest/guide/platforms/ios/index.html"}
+
+    - {old: "dev/guide/platforms/ios/config.html", new: "dev/config_ref/index.html"}
     - {old: "latest/guide/platforms/ios/config.html", new: "latest/config_ref/index.html"}
+
+    - {old: "dev/guide/platforms/win8/packaging.html", new: "dev/guide/platforms/win8/index.html#signing-an-app"}
     - {old: "latest/guide/platforms/win8/packaging.html", new: "latest/guide/platforms/win8/index.html#signing-an-app"}
+
+    - {old: "dev/guide/platforms/win8/win10-support.html", new: "dev/guide/platforms/win8/index.html"}
     - {old: "latest/guide/platforms/win8/win10-support.html", new: "latest/guide/platforms/win8/index.html"}
+
+    - {old: "dev/cordova/plugins/pluginapis.html", new: "deprecated.html"}
     - {old: "latest/cordova/plugins/pluginapis.html", new: "deprecated.html"}
 
     # NOTE:
@@ -50,7 +65,7 @@ docs:
     - {old: "latest/cordova-plugin-whitelist/index.html", new: "latest/reference/cordova-plugin-whitelist/index.html"}
     - {old: "latest/cordova-plugin-legacy-whitelist/index.html", new: "latest/reference/cordova-plugin-legacy-whitelist/index.html"}
 
-# redirects paths relative to /docs/XX/YYY/
+# 301 (PERMANENT) redirect paths relative to /docs/XX/YYY/
 docs-global:
     - {old: "config_ref_images.md.html", new: "config_ref/images.html"}
     - {old: "config_ref_index.md.html", new: "config_ref/index.html"}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message