fix: fix rich search suggestion link (#272)

* bug: Fix search result links

* fix: fix search suggestion article path duplication

Co-authored-by: Hannes <hannes@octofox.de>
This commit is contained in:
alistair3149 2021-02-18 14:16:44 -05:00 committed by GitHub
parent 6e4f1223ed
commit 340fd78bcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,6 @@ window.WMTypeAhead = function ( appendTo, searchInput ) {
appendEl = document.getElementById( appendTo ),
searchEl = document.getElementById( searchInput ),
server = mw.config.get( 'wgServer' ),
articleurl = server + mw.config.get( 'wgArticlePath' ).replace( '$1', '' ),
searchurl = server + mw.config.get( 'wgScriptPath' ) + '/index.php?title=Special%3ASearch&search=',
thumbnailSize = Math.round( getDevicePixelRatio() * 80 ),
descriptionSource = mw.config.get( 'wgCitizenSearchDescriptionSource' ),
@ -430,7 +429,7 @@ window.WMTypeAhead = function ( appendTo, searchInput ) {
suggestionLink = mw.html.element( 'a', {
class: 'suggestion-link',
id: suggestionLinkID,
href: articleurl + encodeURIComponent( page.title.replace( / /gi, '_' ) )
href: server + (new mw.Title( page.title, page.ns ?? 0 ).getUrl()),
}, new mw.html.Raw( suggestionThumbnail + suggestionText ) );
string += suggestionLink;