diff --git a/README.md b/README.md index 52c95e7..175431c 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Key | Value | Explanation `logo_postition`| left|right | The side of the site name at which the logo should be placed. Only has an effect if the above is not set to an empty string. `updateurl` | url | The url from which to fetch updates. Defaults to the master (development) branch. If there is sufficient demand, a separate stable branch will be created. Note that if you use the automatic updater currently it won't save your module choices. **MAKE SURE THAT THIS POINTS TO A *HTTPS* URL, OTHERWISE SOMEONE COULD INJECT A VIRUS INTO YOUR WIKI!** `sitesecret` | string | The secret key used to perform 'dangerous' actions, like updating the wiki. It is strongly advised that you change this! +`delayed_indexing_time` | integer | The amount of time, in seconds, that pages should be blocked from being indexed by search engines after their last edit. Set to 0 to disable. This is called delayed indexing. More information can be found [here](http://c2.com/cgi/wiki?DelayedIndexing). `editing` | boolean | Determines whether editing is enabled. Set to false to disable disting for all users (anonymous or otherwise). `maxpagesize` | integer | The maximum number of characters allowed on a single page. The default is 135,000 characters, which is about 50 pages. `clean_raw_html`| boolean | Whether page sources should be cleaned of HTML before rendering. If set to true any raw HTML will be escaped before rendering. Note that this shouldn't affect code blocks - they should alwys be escaped. It is STRONGLY recommended that you keep this option turned on, **_ESPECIALLY_** if you allow anonymous edits as no sanitizing whatsoever is performed on the HTML. If you need a feature that the markdown parser doesn't have, please open an issue. Also note that some parsers may override this setting and escape HTML sequences anyway. diff --git a/build/index.php b/build/index.php index 530889e..ade835e 100644 --- a/build/index.php +++ b/build/index.php @@ -137,6 +137,10 @@ $settings->data_storage_dir = "."; // It is strongly advised that you change this! $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02"; +// The amount of time, in seconds, that pages should be blocked from being +// indexed by search engines after their last edit. Aka delayed indexing. +$settings->delayed_indexing_time = 0; + //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// Navigation ////////////////////////////////// @@ -4256,6 +4260,12 @@ register_module([ $content .= "\n\t\t\n"; + // Prevent indexing of this page if it's still within the noindex + // time period + if(isset($settings->delayed_indexing_time) and + time() - $pageindex->{$env->page}->lastmodified < $settings->delayed_indexing_time) + header("x-robots-tag: noindex"); + // Content only mode: Sends only the raw rendered page if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes") exit(parse_page_source($content)); diff --git a/module_index.json b/module_index.json index d93333a..94b3172 100644 --- a/module_index.json +++ b/module_index.json @@ -176,7 +176,7 @@ "author": "Starbeamrainbowlabs", "description": "Allows you to view pages. You really should include this one.", "id": "page-view", - "lastupdate": 1458906065, + "lastupdate": 1462012572, "optional": false }, { diff --git a/modules/page-view.php b/modules/page-view.php index c321bd1..3a896f5 100644 --- a/modules/page-view.php +++ b/modules/page-view.php @@ -102,6 +102,12 @@ register_module([ $content .= "\n\t\t\n"; + // Prevent indexing of this page if it's still within the noindex + // time period + if(isset($settings->delayed_indexing_time) and + time() - $pageindex->{$env->page}->lastmodified < $settings->delayed_indexing_time) + header("x-robots-tag: noindex"); + // Content only mode: Sends only the raw rendered page if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes") exit(parse_page_source($content)); diff --git a/settings.fragment.php b/settings.fragment.php index 5b8b162..bae1459 100644 --- a/settings.fragment.php +++ b/settings.fragment.php @@ -134,6 +134,10 @@ $settings->data_storage_dir = "."; // It is strongly advised that you change this! $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02"; +// The amount of time, in seconds, that pages should be blocked from being +// indexed by search engines after their last edit. Aka delayed indexing. +$settings->delayed_indexing_time = 0; + //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// Navigation //////////////////////////////////