Repository: cordova-docs Updated Branches: refs/heads/master c0555cc87 -> 9f2e4a2ba
Adding 301 redirects for old docs pages in .htaccess. Adding a 404 redirect for pages that don't exist in certain docs versions. Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/9f2e4a2b Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/9f2e4a2b Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/9f2e4a2b Branch: refs/heads/master Commit: 9f2e4a2ba624047a50d97bfcf4b2512027de0a03 Parents: c0555cc Author: Dmitry Blotsky <[email protected]> Authored: Tue Oct 27 00:33:20 2015 -0700 Committer: Dmitry Blotsky <[email protected]> Committed: Tue Oct 27 17:30:36 2015 -0700 ---------------------------------------------------------------------- www/.htaccess | 21 +++++ www/_data/docs-redirects.yml | 157 ++++++++++++++++++++++++++++++++++++++ www/http/404.html | 7 +- www/static/js/404.js | 22 ++++-- 4 files changed, 198 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9f2e4a2b/www/.htaccess ---------------------------------------------------------------------- diff --git a/www/.htaccess b/www/.htaccess index d17cd86..66d177e 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -1,3 +1,24 @@ --- --- + ErrorDocument 404 {{ site.baseurl }}/404.html + +# Redirects for old docs pages +Options +FollowSymLinks +RewriteEngine on + +# only bother applying the below rules for docs pages +# NOTE: +# the leading slash is optional, so it has a '?' before it +RewriteCond %{REQUEST_URI} ^.*{{ site.baseurl }}/?docs/.*$ + +# create a 301 mapping with a RewriteRule for each +# docs redirect specified in _data/docs-redirects.yml +# NOTE: +# the leading slash is optional because sometimes +# REQUEST_URI doesn't contain it +# NOTE: +# the first part of the path (i.e. $1) is not used because the new +# URI's prefix is known and fixed by us (i.e. baseurl/docs/...) +{% for redirect in site.data.docs-redirects %} +RewriteRule ^.*(/?)docs/([^/]{2,2})/([^/]+)/{{ redirect.old }}$ {{ site.baseurl }}/docs/$2/$3/{{ redirect.new }} [R=301]{% endfor %} http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9f2e4a2b/www/_data/docs-redirects.yml ---------------------------------------------------------------------- diff --git a/www/_data/docs-redirects.yml b/www/_data/docs-redirects.yml new file mode 100644 index 0000000..bf4ec15 --- /dev/null +++ b/www/_data/docs-redirects.yml @@ -0,0 +1,157 @@ +- {old: "config_ref_images.md.html", new: "config_ref/images.html"} +- {old: "config_ref_index.md.html", new: "config_ref/index.html"} +- {old: "cordova_accelerometer_accelerometer.md.html", new: "cordova/accelerometer/accelerometer.html"} +- {old: "cordova_camera_camera.cleanup.md.html", new: "cordova/camera/camera.cleanup.html"} +- {old: "cordova_camera_camera.md.html", new: "cordova/camera/camera.html"} +- {old: "cordova_compass_compass.md.html", new: "cordova/compass/compass.html"} +- {old: "cordova_connection_connection.md.html", new: "cordova/connection/connection.html"} +- {old: "cordova_contacts_contacts.md.html", new: "cordova/contacts/contacts.html"} +- {old: "cordova_device_device.md.html", new: "cordova/device/device.html"} +- {old: "cordova_device_device.model.md.html", new: "cordova/device/device.model.html"} +- {old: "cordova_events_events.md.html", new: "cordova/events/events.html"} +- {old: "cordova_file_file.md.html", new: "cordova/file/file.html"} +- {old: "cordova_geolocation_geolocation.md.html", new: "cordova/geolocation/geolocation.html"} +- {old: "cordova_globalization_globalization.md.html", new: "cordova/globalization/globalization.html"} +- {old: "cordova_inappbrowser_inappbrowser.md.html", new: "cordova/inappbrowser/inappbrowser.html"} +- {old: "cordova_media_capture_capture.md.html", new: "cordova/media/capture/capture.html"} +- {old: "cordova_media_media.md.html", new: "cordova/media/media.html"} +- {old: "cordova_notification_notification.md.html", new: "cordova/notification/notification.html"} +- {old: "cordova_splashscreen_splashscreen.md.html", new: "cordova/splashscreen/splashscreen.html"} +- {old: "cordova_storage_storage.md.html", new: "cordova/storage/storage.html"} +- {old: "guide_appdev_privacy_index.md.html", new: "guide/appdev/privacy/index.html"} +- {old: "guide_appdev_whitelist_index.md.html", new: "guide/appdev/whitelist/index.html"} +- {old: "guide_cli_index.md.html", new: "guide/cli/index.html"} +- {old: "guide_hybrid_plugins_index.md.html", new: "guide/hybrid/plugins/index.html"} +- {old: "guide_hybrid_webviews_index.md.html", new: "guide/hybrid/webviews/index.html"} +- {old: "guide_overview_index.md.html", new: "guide/overview/index.html"} +- {old: "guide_platforms_android_config.md.html", new: "guide/platforms/android/config.html"} +- {old: "guide_platforms_android_index.md.html", new: "guide/platforms/android/index.html"} +- {old: "guide_platforms_android_plugin.md.html", new: "guide/platforms/android/plugin.html"} +- {old: "guide_platforms_android_tools.md.html", new: "guide/platforms/android/tools.html"} +- {old: "guide_platforms_android_upgrading.md.html", new: "guide/platforms/android/upgrading.html"} +- {old: "guide_platforms_android_webview.md.html", new: "guide/platforms/android/webview.html"} +- {old: "guide_platforms_blackberry10_config.md.html", new: "guide/platforms/blackberry10/config.html"} +- {old: "guide_platforms_blackberry10_index.md.html", new: "guide/platforms/blackberry10/index.html"} +- {old: "guide_platforms_blackberry10_plugin.md.html", new: "guide/platforms/blackberry10/plugin.html"} +- {old: "guide_platforms_blackberry10_tools.md.html", new: "guide/platforms/blackberry10/tools.html"} +- {old: "guide_platforms_blackberry10_upgrading.md.html", new: "guide/platforms/blackberry10/upgrading.html"} +- {old: "guide_platforms_blackberry_config.md.html", new: "guide/platforms/blackberry/config.html"} +- {old: "guide_platforms_blackberry_index.md.html", new: "guide/platforms/blackberry/index.html"} +- {old: "guide_platforms_blackberry_plugin.md.html", new: "guide/platforms/blackberry/plugin.html"} +- {old: "guide_platforms_blackberry_tools.md.html", new: "guide/platforms/blackberry/tools.html"} +- {old: "guide_platforms_blackberry_upgrading.md.html", new: "guide/platforms/blackberry/upgrading.html"} +- {old: "guide_platforms_firefoxos_config.md.html", new: "guide/platforms/firefoxos/config.html"} +- {old: "guide_platforms_index.md.html", new: "guide/platforms/index.html"} +- {old: "guide_platforms_ios_config.md.html", new: "guide/platforms/ios/config.html"} +- {old: "guide_platforms_ios_index.md.html", new: "guide/platforms/ios/index.html"} +- {old: "guide_platforms_ios_plugin.md.html", new: "guide/platforms/ios/plugin.html"} +- {old: "guide_platforms_ios_tools.md.html", new: "guide/platforms/ios/tools.html"} +- {old: "guide_platforms_ios_upgrading.md.html", new: "guide/platforms/ios/upgrading.html"} +- {old: "guide_platforms_ios_webview.md.html", new: "guide/platforms/ios/webview.html"} +- {old: "guide_platforms_tizen_index.md.html", new: "guide/platforms/tizen/index.html"} +- {old: "guide_platforms_win8_index.md.html", new: "guide/platforms/win8/index.html"} +- {old: "guide_platforms_win8_tools.md.html", new: "guide/platforms/win8/tools.html"} +- {old: "guide_platforms_win8_upgrading.md.html", new: "guide/platforms/win8/upgrading.html"} +- {old: "guide_platforms_wp7_index.md.html", new: "guide/platforms/wp7/index.html"} +- {old: "guide_platforms_wp8_index.md.html", new: "guide/platforms/wp8/index.html"} +- {old: "guide_platforms_wp8_plugin.md.html", new: "guide/platforms/wp8/plugin.html"} +- {old: "guide_platforms_wp8_tools.md.html", new: "guide/platforms/wp8/tools.html"} +- {old: "guide_platforms_wp8_upgrading.md.html", new: "guide/platforms/wp8/upgrading.html"} +- {old: "plugin_ref_plugman.md.html", new: "plugin_ref/plugman.html"} +- {old: "plugin_ref_spec.md.html", new: "plugin_ref/spec.html"} +- {old: "cordova_plugins_pluginapis.md.html", new: "cordova/plugins/pluginapis.html"} +- {old: "cordova_storage_database_database.md.html", new: "cordova/storage/database/database.html"} +- {old: "cordova_storage_localstorage_localstorage.md.html", new: "cordova/storage/localstorage/localstorage.html"} +- {old: "cordova_storage_parameters_display_name.md.html", new: "cordova/storage/parameters/display_name.html"} +- {old: "cordova_storage_parameters_name.md.html", new: "cordova/storage/parameters/name.html"} +- {old: "cordova_storage_parameters_size.md.html", new: "cordova/storage/parameters/size.html"} +- {old: "cordova_storage_parameters_version.md.html", new: "cordova/storage/parameters/version.html"} +- {old: "cordova_storage_sqlerror_sqlerror.md.html", new: "cordova/storage/sqlerror/sqlerror.html"} +- {old: "cordova_storage_sqlresultset_sqlresultset.md.html", new: "cordova/storage/sqlresultset/sqlresultset.html"} +- {old: "cordova_storage_sqlresultsetrowlist_sqlresultsetrowlist.md.html", new: "cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.html"} +- {old: "cordova_storage_sqltransaction_sqltransaction.md.html", new: "cordova/storage/sqltransaction/sqltransaction.html"} +- {old: "cordova_storage_storage.opendatabase.md.html", new: "cordova/storage/storage.opendatabase.html"} +- {old: "guide_platforms_amazonfireos_config.md.html", new: "guide/platforms/amazonfireos/config.html"} +- {old: "guide_platforms_amazonfireos_index.md.html", new: "guide/platforms/amazonfireos/index.html"} +- {old: "guide_platforms_amazonfireos_plugin.md.html", new: "guide/platforms/amazonfireos/plugin.html"} +- {old: "guide_platforms_amazonfireos_webview.md.html", new: "guide/platforms/amazonfireos/webview.html"} +- {old: "guide_platforms_ubuntu_index.md.html", new: "guide/platforms/ubuntu/index.html"} +- {old: "guide_support_index.md.html", new: "guide/support/index.html"} +- {old: "guide_appdev_hooks_index.md.html", new: "guide/appdev/hooks/index.html"} +- {old: "guide_appdev_security_index.md.html", new: "guide/appdev/security/index.html"} +- {old: "guide_next_index.md.html", new: "guide/next/index.html"} +- {old: "guide_platforms_android_upgrade.md.html", new: "guide/platforms/android/upgrade.html"} +- {old: "guide_platforms_blackberry10_upgrade.md.html", new: "guide/platforms/blackberry10/upgrade.html"} +- {old: "guide_platforms_blackberry_upgrade.md.html", new: "guide/platforms/blackberry/upgrade.html"} +- {old: "guide_platforms_firefoxos_index.md.html", new: "guide/platforms/firefoxos/index.html"} +- {old: "guide_platforms_ios_upgrade.md.html", new: "guide/platforms/ios/upgrade.html"} +- {old: "guide_platforms_win8_packaging.md.html", new: "guide/platforms/win8/packaging.html"} +- {old: "guide_platforms_win8_plugin.md.html", new: "guide/platforms/win8/plugin.html"} +- {old: "guide_platforms_win8_upgrade.md.html", new: "guide/platforms/win8/upgrade.html"} +- {old: "guide_platforms_win8_win10-support.md.html", new: "guide/platforms/win8/win10-support.html"} +- {old: "guide_platforms_wp8_parallels.md.html", new: "guide/platforms/wp8/parallels.html"} +- {old: "guide_platforms_wp8_upgrade.md.html", new: "guide/platforms/wp8/upgrade.html"} +- {old: "guide_platforms_wp8_vmware.md.html", new: "guide/platforms/wp8/vmware.html"} +- {old: "guide_platforms_wp8_webview.md.html", new: "guide/platforms/wp8/webview.html"} +- {old: "platform_plugin_versioning_ref_index.md.html", new: "platform_plugin_versioning_ref/index.html"} +- {old: "guide_getting-started_android_index.md.html", new: "guide/getting-started/android/index.html"} +- {old: "guide_getting-started_blackberry_index.md.html", new: "guide/getting-started/blackberry/index.html"} +- {old: "guide_getting-started_index.md.html", new: "guide/getting-started/index.html"} +- {old: "guide_getting-started_ios_index.md.html", new: "guide/getting-started/ios/index.html"} +- {old: "guide_getting-started_symbian_index.md.html", new: "guide/getting-started/symbian/index.html"} +- {old: "guide_getting-started_webos_index.md.html", new: "guide/getting-started/webos/index.html"} +- {old: "guide_getting-started_windows-phone_index.md.html", new: "guide/getting-started/windows-phone/index.html"} +- {old: "guide_upgrading_blackberry_index.md.html", new: "guide/upgrading/blackberry/index.html"} +- {old: "guide_upgrading_webos_index.md.html", new: "guide/upgrading/webos/index.html"} +- {old: "phonegap_accelerometer_accelerometer.md.html", new: "phonegap/accelerometer/accelerometer.html"} +- {old: "phonegap_camera_camera.md.html", new: "phonegap/camera/camera.html"} +- {old: "phonegap_compass_compass.md.html", new: "phonegap/compass/compass.html"} +- {old: "phonegap_connection_connection.md.html", new: "phonegap/connection/connection.html"} +- {old: "phonegap_contacts_contacts.md.html", new: "phonegap/contacts/contacts.html"} +- {old: "phonegap_device_device.md.html", new: "phonegap/device/device.html"} +- {old: "phonegap_events_events.md.html", new: "phonegap/events/events.html"} +- {old: "phonegap_file_file.md.html", new: "phonegap/file/file.html"} +- {old: "phonegap_geolocation_geolocation.md.html", new: "phonegap/geolocation/geolocation.html"} +- {old: "phonegap_media_capture_capture.md.html", new: "phonegap/media/capture/capture.html"} +- {old: "phonegap_media_media.md.html", new: "phonegap/media/media.html"} +- {old: "phonegap_notification_notification.md.html", new: "phonegap/notification/notification.html"} +- {old: "phonegap_storage_storage.md.html", new: "phonegap/storage/storage.html"} +- {old: "guide_getting-started_bada_index.md.html", new: "guide/getting-started/bada/index.html"} +- {old: "guide_upgrading_android_index.md.html", new: "guide/upgrading/android/index.html"} +- {old: "guide_upgrading_bada_index.md.html", new: "guide/upgrading/bada/index.html"} +- {old: "guide_upgrading_index.md.html", new: "guide/upgrading/index.html"} +- {old: "guide_upgrading_ios_index.md.html", new: "guide/upgrading/ios/index.html"} +- {old: "guide_upgrading_symbian_index.md.html", new: "guide/upgrading/symbian/index.html"} +- {old: "guide_upgrading_windows-phone_index.md.html", new: "guide/upgrading/windows-phone/index.html"} +- {old: "guide_whitelist_index.md.html", new: "guide/whitelist/index.html"} +- {old: "guide_command-line_index.md.html", new: "guide/command-line/index.html"} +- {old: "guide_cordova-webview_android.md.html", new: "guide/cordova-webview/android.html"} +- {old: "guide_cordova-webview_index.md.html", new: "guide/cordova-webview/index.html"} +- {old: "guide_cordova-webview_ios.md.html", new: "guide/cordova-webview/ios.html"} +- {old: "guide_plugin-development_android_index.md.html", new: "guide/plugin-development/android/index.html"} +- {old: "guide_plugin-development_bada_index.md.html", new: "guide/plugin-development/bada/index.html"} +- {old: "guide_plugin-development_blackberry_index.md.html", new: "guide/plugin-development/blackberry/index.html"} +- {old: "guide_plugin-development_index.md.html", new: "guide/plugin-development/index.html"} +- {old: "guide_plugin-development_ios_index.md.html", new: "guide/plugin-development/ios/index.html"} +- {old: "guide_plugin-development_webos_index.md.html", new: "guide/plugin-development/webos/index.html"} +- {old: "guide_plugin-development_windows-phone_index.md.html", new: "guide/plugin-development/windows-phone/index.html"} +- {old: "guide_getting-started_tizen_index.md.html", new: "guide/getting-started/tizen/index.html"} +- {old: "guide_plugin-development_tizen_index.md.html", new: "guide/plugin-development/tizen/index.html"} +- {old: "guide_upgrading_tizen_index.md.html", new: "guide/upgrading/tizen/index.html"} +- {old: "guide_getting-started_windows-8_index.md.html", new: "guide/getting-started/windows-8/index.html"} +- {old: "guide_project-settings_index.md.html", new: "guide/project-settings/index.html"} +- {old: "guide_project-settings_ios_index.md.html", new: "guide/project-settings/ios/index.html"} +- {old: "guide_getting-started_windows-phone-7_index.md.html", new: "guide/getting-started/windows-phone-7/index.html"} +- {old: "guide_getting-started_windows-phone-8_index.md.html", new: "guide/getting-started/windows-phone-8/index.html"} +- {old: "guide_project-settings_android_index.md.html", new: "guide/project-settings/android/index.html"} +- {old: "guide_project-settings_bada_index.md.html", new: "guide/project-settings/bada/index.html"} +- {old: "guide_project-settings_blackberry_index.md.html", new: "guide/project-settings/blackberry/index.html"} +- {old: "guide_project-settings_firefoxos_index.md.html", new: "guide/project-settings/firefoxos/index.html"} +- {old: "guide_project-settings_webos_index.md.html", new: "guide/project-settings/webos/index.html"} +- {old: "guide_project-settings_windows8_index.md.html", new: "guide/project-settings/windows8/index.html"} +- {old: "guide_project-settings_wp7_index.md.html", new: "guide/project-settings/wp7/index.html"} +- {old: "guide_project-settings_wp8_index.md.html", new: "guide/project-settings/wp8/index.html"} +- {old: "guide_getting-started_blackberry10_index.md.html", new: "guide/getting-started/blackberry10/index.html"} +- {old: "guide_plugin-development_blackberry10_index.md.html", new: "guide/plugin-development/blackberry10/index.html"} +- {old: "guide_privacy_index.md.html", new: "guide/privacy/index.html"} +- {old: "guide_upgrading_windows-8_index.md.html", new: "guide/upgrading/windows-8/index.html"} http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9f2e4a2b/www/http/404.html ---------------------------------------------------------------------- diff --git a/www/http/404.html b/www/http/404.html index 94585f8..999577c 100644 --- a/www/http/404.html +++ b/www/http/404.html @@ -9,10 +9,13 @@ permalink: 404.html <h1>404: Not Found</h1> </div> <div id="not-found-redirect-alert" class="not-found-redirect"> - <div class="alert alert-warning" role="alert">It looks like the content has moved <a id="new-redirect-link">here</a>.</div> + <div class="alert alert-warning" role="alert">It looks like the content has <em>moved</em> <a id="new-redirect-link">here</a>.</div> </div> <div id="no-version-redirect-alert" class="not-found-redirect"> - <div class="alert alert-warning" role="alert">It looks like this version isn't translated. The in-development version is <a id="edge-redirect-link">here</a>.</div> + <div class="alert alert-warning" role="alert">It looks like this version <em>isn't translated</em>. The in-development version is <a id="edge-redirect-link">here</a>.</div> + </div> + <div id="no-page-redirect-alert" class="not-found-redirect"> + <div class="alert alert-warning" role="alert">It looks like this page <em>doesn't exist in this version</em> of the docs. The main page for this version is <a id="root-redirect-link">here</a>.</div> </div> </div> <script type="text/javascript" src="{{ site.baseurl }}/static/js/404.js" defer></script> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9f2e4a2b/www/static/js/404.js ---------------------------------------------------------------------- diff --git a/www/static/js/404.js b/www/static/js/404.js index 37c32be..eb1b9b9 100644 --- a/www/static/js/404.js +++ b/www/static/js/404.js @@ -42,10 +42,6 @@ return DOCS_VERSION_PATTERN.test(url); } - function tryURL(url, responseMap) { - $.ajax({url: url, statusCode: responseMap}); - } - function showNewRedirect(url) { $("#new-redirect-link").attr("href", url); $("#not-found-redirect-alert").css("display", "block"); @@ -56,6 +52,11 @@ $("#no-version-redirect-alert").css("display", "block"); } + function showRootRedirect(url) { + $("#root-redirect-link").attr("href", url); + $("#no-page-redirect-alert").css("display", "block"); + } + function main() { var url = window.location.href; @@ -74,20 +75,27 @@ url: rootURL, statusCode: { - // if the root exists, before offering the new - // URL, also check if it exists + // if the root exists, check if the new URL exists 200: function () { $.ajax({ url: newURL, statusCode: { + + // redirect to the new URL if it exists 200: function () { showNewRedirect(newURL) + }, + + // if the new URL doesn't exist, redirect to root + 404: function() { + showRootRedirect(rootURL) } } }); }, - // if it doesn't exist, assume that the version is invalid + // if root doesn't exist, assume that the version + // is invalid and redirect to edge 404: function () { showEdgeRedirect(edgeURL) } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
