Skip to content

Commit 88f7372

Browse files
committed
Update Firefox extension to redirect new versions
1 parent 8b104d9 commit 88f7372

3 files changed

Lines changed: 12 additions & 16 deletions

File tree

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
### Intro
22
pg_docs_bot is a browser extension for getting to the current Postgres docs by default.
3-
* [Firefox addon](https://addons.mozilla.org/en-US/firefox/addon/pg_docs_bot/)
43
* [Chrome extension](https://chrome.google.com/webstore/detail/pgdocsbot/hkbfkapgdfedgidpfbhlogecohcnaeod?hl=en-GB)
5-
* It is also trivial to install manually, if you prefer
4+
* [Firefox addon](https://addons.mozilla.org/en-US/firefox/addon/pg_docs_bot/)
5+
* It is also possible to install extensions locally, if you prefer
66

77
### Benefits
8-
When you search for Postgres related things, an old version of the documentation is often indexed. Similarly, some answers on sites like Stack Overflow link to old versions of the documentation. pg_docs_bot helps you avoid the annoyance of having to click "Current" when you get there, the frustration of having read the whole page before realising it was an old version, or even worse, not realising that it was an out of date version at all.
8+
When you search for Postgres related things, an old version of the documentation is sometimes top of the list (although this was far more of a problem several years ago). Similarly, some links on sites like Stack Overflow are to old versions of the documentation.
9+
10+
pg_docs_bot helps you avoid having to click "Current" when you get there, or the frustration of reading the information before realising it's out of date, or (even worse) not realising at all.
911

1012
### Fixing the root cause
11-
Naturally, this extension doesn't help solve the root cause(s) of this issue.
13+
There have been many conversations on the PostgreSQL mailing lists about how to teach search engines which version to link to. In 2021 a [huge improvement](https://www.postgresql.org/message-id/flat/CABUevEyGwaZE8KJg%3D-K4f7moUo%3DUbV3AFbnmtTB-c31ojNn2Vg%40mail.gmail.com#611b31dcdc09aba835ef561ad15bed69) was made to the docs to let search engines know that the `current` version should be considered canonical, which has helped tremendously.
1214

13-
There have been many conversations on the PostgreSQL mailing lists about how to teach search engines which version to link to. (June 2021 update: there is a [new thread](https://www.postgresql.org/message-id/flat/CABUevEyGwaZE8KJg%3D-K4f7moUo%3DUbV3AFbnmtTB-c31ojNn2Vg%40mail.gmail.com#611b31dcdc09aba835ef561ad15bed69) that seems promising). Please also continue to encourage people (eg on Stack Overflow or in blog posts) to link to the `current` version, which should gradually help.
15+
For the likes of Stack Overflow and blog posts, please do link to the `current` version whenever you aren't specifically referencing something version-specific.
1416

1517
### Features of pg_docs_bot
1618
* Redirects links to the `current` version
@@ -19,15 +21,9 @@ There have been many conversations on the PostgreSQL mailing lists about how to
1921
* Doesn't redirect when coming from another page in the docs, so you can still check old versions (the main problem with generic redirectors)
2022

2123
### Limitations
22-
* Only supports redirecting to `current` (request [support for other versions](https://github.com/mchristofides/pg_docs_bot/issues/1))
24+
* Only supports redirecting to `current` (here's [an alternative that does](https://github.com/dougharris/unified_docs_switcher))
2325
* Works for the English language docs
24-
* Works for version 7.0 links upwards
25-
* Chrome extension works on a limited list of search engines and Stack Exchange sites (to avoid needing <all_urls> permission)
26-
27-
### Examples
28-
Here is an example of a [search for "postgresql create index"](https://duckduckgo.com/?q=postgresql+create+index). At the time of writing, the 9.1 version of the docs is the first search result (the "current" version is 12).
29-
30-
### Requests, issues, PRs
31-
There are some feature ideas in the [issues](https://github.com/mchristofides/pg_docs_bot/issues). Bug reports and PRs super welcome.
26+
* Works for v7.0 through v17 links
27+
* The Chrome extension only works on a limited set of search engines and Stack Exchange sites (to avoid needing the <all_urls> permission)
3228

3329
![alt text](https://github.com/mchristofides/pg_docs_bot/blob/trunk/slonik_in_glasses_128.png)

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg_docs_bot",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Redirects PostgreSQL docs links to the current version (except when coming from the docs, or to deprecated features).",
55
"homepage_url": "https://github.com/mchristofides/pg_docs_bot",
66
"manifest_version": 2,

redirectdocs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ chrome.webRequest.onBeforeRequest.addListener(function(details){
2121
}
2222
else {
2323
//Replace version numbers 7+ as notice now makes 404s less bad. Should probably also replace devel once people can set a default.
24-
var redirectUrl = details.url.replace(/docs\/(current\/|7|7\.0|7\.1|7\.2|7\.3|7\.4|8|8\.0|8\.1|8\.2|8\.3|8\.4|9|9\.0|9\.1|9\.2|9\.3|9\.4|9\.5|9\.6|10|11|12|13)\//, pgdocsversion);
24+
var redirectUrl = details.url.replace(/docs\/(current\/|7|7\.0|7\.1|7\.2|7\.3|7\.4|8|8\.0|8\.1|8\.2|8\.3|8\.4|9|9\.0|9\.1|9\.2|9\.3|9\.4|9\.5|9\.6|10|11|12|13|14|15|16|17)\//, pgdocsversion);
2525
if (redirectUrl === details.url) {
2626
return {cancel: false};
2727
}

0 commit comments

Comments
 (0)