Opened 10 years ago

Closed 9 years ago

#2245 closed enhancement (fixed)

[PATCH] Add links to wiki Key:* and Tag:* pages from /browse/* pages

Reported by: StefanB Owned by: Tom Hughes
Priority: minor Milestone: Wishlist
Component: website Version:
Keywords: patch Cc:

Description

It would be very nice if tags and values in data browser would link to wiki if the wiki page is already existing.

eg highway=residential would be linked to:

http://wiki.openstreetmap.org/wiki/Tag:highway (on key) http://wiki.openstreetmap.org/wiki/Tag:highway%3Dresidential (on value)

links could be prefixed with language code http://wiki.openstreetmap.org/wiki/DE:Tag:highway%3Dresidential if translation exists, or fall back onto default (english) page.

I'm sure mediawiki has some api to get list of existing pages (preferably only those with "Tag:" in title) and this list could be cached by rails app for up to some hours.

Attachments (2)

add-links-to-wiki.patch (28.0 KB) - added by avar 10 years ago.
The patch originally attached to #2289
add-links-to-wiki-2.patch (6.8 KB) - added by avar 9 years ago.
Updated patch to use the API on the wiki & use app/helpers

Download all attachments as: .zip

Change History (14)

comment:1 Changed 10 years ago by Tom Hughes

Milestone: Wishlist
Priority: majorminor

At the very least I think this needs to wait until the wiki is moved to it's new server - more load is the last thing it needs at the moment. That should be happening fairly soon.

It is also of course going to need somebody to write a fairly substantial amount of code.

comment:2 Changed 10 years ago by StefanB

I am interested in coding this, but would need some help here and there.

To prevent serving tons of dead links (frustrating for users) we'd need an API call in wiki to list existing pages like: http://wiki.openstreetmap.org/index.php?title=Special%3APrefixIndex&from=Tag%3A&namespace=0

but more computer friendly (xml), if possible. Wikimedia API (as on http://en.wikipedia.org/w/api.php )doesn't seem to be installed and seems rather handy for the purpose (eg http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefix=Map&aplimit=50 ) (would need to change prefix to "Tag:" for our use)

alternatively all pages in all subcategories of http://wiki.openstreetmap.org/wiki/Category:Tags could be enumerated somehow

Also it's essential to cache the result from the api call.

comment:3 in reply to:  2 Changed 10 years ago by StefanB

Replying to StefanB:

Wikimedia API (as on http://en.wikipedia.org/w/api.php )doesn't seem to be installed

oops, it is available at: http://wiki.openstreetmap.org/api.php hooray!

comment:4 Changed 10 years ago by Tom Hughes

In case you didn't get it I'm not exactly enthusiastic about this idea anyway, given how full of shit the tagging pages on the wiki are ;-)

comment:5 in reply to:  4 Changed 10 years ago by StefanB

Replying to tom@compton.nu:

In case you didn't get it I'm not exactly enthusiastic about this idea anyway, given how full of shit the tagging pages on the wiki are ;-)

ok, ok, i can hold my horses for a while :)

Might give a nice push to tidy up the wiki documentation once the wiki server can handle the extra load though.

If i come up with anything I'll make sure it is acceptable for you before checking anything in ... this time :) Probably just attaching patches here until then.

Perhaps limiting the linking to few "approved" wiki pages (or just link keys, not values) could also lower the load and make sure only nice pages are linked, but it would take the automation out of the process.

comment:6 Changed 10 years ago by Tom Hughes

See patch on duplicate case #2289.

comment:7 Changed 10 years ago by avar

Keywords: patch added
Summary: tags could lnik to existing wiki pages[PATCH] Add links to wiki Key:* and Tag:* pages from /browse/* pages

More accurate summary (from the duplicate bug)

Changed 10 years ago by avar

Attachment: add-links-to-wiki.patch added

The patch originally attached to #2289

comment:8 Changed 10 years ago by StefanB

Is there any difference between using mediawiki API or whatlinkshere page in terms of

  • performance
  • correctness

?

Perhaps it could be rolled out with a small subset of linked tags and see how extra visits are affecting wiki.

nice trick with added uselang=de parameter!

comment:9 in reply to:  8 Changed 10 years ago by avar

Replying to StefanB:

Is there any difference between using mediawiki API or whatlinkshere page in terms of

  • performance
  • correctness

?

Well the script is run offline so performance doesn't matter. I couldn't find a way to query special pages like WhatLinkshere? so I just did a tiny bit of screen-scraping.

If there's a better way using the API then by all means let's use that. Although what we have now works. And some script to be run offline periodically isn't something I'm very enthusiastic about optimizing for speed & correctness.

Perhaps it could be rolled out with a small subset of linked tags and see how extra visits are affecting wiki.

Or turning it on and seeing if it keels over :)

nice trick with added uselang=de parameter!

We should be using that with all outgoing links to the wiki. I'm already using it for the Icelandic translation.

comment:10 Changed 9 years ago by avar

We're now running a new wiki version on a new box behind a sane squid setup.

Would it be OK to enable this patch now?

Changed 9 years ago by avar

Attachment: add-links-to-wiki-2.patch added

Updated patch to use the API on the wiki & use app/helpers

comment:11 Changed 9 years ago by avar

I've updated the patch to use the API on the wiki. Before the upgrade the only way to get the list of key/value links was to screen-scrape.

I didn't add the autogenerated YAML file. This has to be added as:

perl script/misc/update-key-and-tag-description-pages-from-wiki config/wiki-tag-and-key-description.yml

And now gives instructions on how to install the required modules from CPAN if they're missing.

Also there are now per-language templates for these key/values. Right now there's a manual list of the respective languages in the perl script. I thought getting this automatically via the search engine might be too brittle.

comment:12 Changed 9 years ago by Tom Hughes

Resolution: fixed
Status: newclosed

This patch has now been merged to the trunk.

Note: See TracTickets for help on using tickets.