Jump to content

메뉴얼:인터위키

From mediawiki.org
This page is a translated version of the page Manual:Interwiki and the translation is 27% complete.
Outdated translations are marked like this.

인터위키 링크(Interwiki links)는 다른 프로젝트들의 문서로 연결하는 것을 의미하며, 접두사를 이용하는 내부적 링크 방식을 사용합니다.

인터위키 링크는 Wikipedia, Wikibooks, Wikinews 등의 문서로 연결이 가능합니다. 또한 다른 언어의 당신의 위키-프로젝트로도 가능합니다. (See 메뉴얼:위키 패밀리 .)

[[Wikipedia:Main Page]] 와 같은 링크는 다음과 같이 나타납니다: Wikipedia:Main Page 로 표시되고 위키백과의 메인페이지로 이동합니다.

인터위키를 다른 프로젝트에 링크하기

Table and query API

Interwiki links are hosted in the interwiki table of the MediaWiki database. You can retrieve the interwiki list from the interwikimap property of the siteinfo meta query API, in other words by making an API request like:

기본

Several Wikimedia projects (and others) are ready for interwiki linking by default, so you can use them without editing your database.

The following are some examples of interwiki prefixes which are available by default (Wikipedia is also available, 1.10 and after):

접두어 목적 URL 사용법 예시
commons https://commons.wikimedia.org/wiki/ [[commons:MediaWiki]]
mediazilla http://bugzilla.wikimedia.org/ [[mediazilla:1209]]
metawikimedia (before version 1.23: metawikipedia) https://meta.wikimedia.org/wiki/ [[metawikimedia:Main Page]]

The full list of default interwiki prefixes is available at maintenance/interwiki.list

See Interwiki linking on Wikimedia wikis for complete information on linking from/to Wikimedia projects.

In some installations, none of these are pre-installed.

새 웹사이트를 추가하기

  • 인터위키 링크는 데이터베이스의 interwiki 테이블 안에 지정되어 있습니다.
  • 이것을 수정하려면, 아래와 같이 데이터베이스를 수정할 필요가 있습니다.

프로세스를 용이하게하는 "인터위키"확장을 사용하는 것이 좋습니다.

The examples below show how to set up w: as a link to the English Wikipedia, in addition the the default more verbose "wikipedia:" entry.

The idea is to insert a line of the form:

('prefix', 'URL format string', 1, 0)

into the interwiki table.

한줄로 하기

Advanced users may use a single command line, as follows:

INSERT INTO interwiki (iw_prefix, iw_url, iw_api, iw_local, iw_trans, iw_wikiid) 
VALUES ('w', 'https://en.wikipedia.org/wiki/$1', 'https://en.wikipedia.org/w/api.php', 0, 1, '');

Export, add, re-import

Alternatively, you can use the following multi-step process, which exports the interwiki table, adds a line, then re-imports it:

  • Export the database table interwiki
  • add to the end of the table a line of the following form (using English wikipedia as an example):
('w', 'https://en.wikipedia.org/wiki/$1', 1, 0);
In the above code, the semicolon ';' as seen, MUST be at the end of the table. At the end of any other line within that table Only has ','.
  • Import the database table interwiki

시험하기

시험하기 환경설정:

  • 당신의 사이트로 가세요,
  • create an article, with the following content:
  • [[w:Wikipedia:Village pump|]]
  • This should display a link to the 'Village pump' page on en.Wikipedia.org (the url https://en.wikipedia.org/wiki/Wikipedia:Village_pump)

필드에 대한 설명


위키 관리자를 위한 정보: Several help pages link to MediaWiki.org's Manual namespace. To make these links work on your local wiki, add an interwiki link with iw_prefix=manual and iw_url=http://www.mediawiki.org/wiki/Manual:$1

위키 관리자를 위한 정보: $wgTranscludeCacheExpiry in your LocalSettings.php should be set if changes in the transcluded wiki are done. Alternatively, you can flush the table transcache on your local wiki.

기타 언어로 인터위키 링크 걸기

기타 언어로 인터위키 링크 걸기

If you have installed a Wiki family , you can link from an article in English to an article in German (if you have a German project, too). You can set up MediaWiki to show those links in the sidebar, just below the toolbox.

In your filesystem, there is a subfolder of your MediaWiki installation, called "languages". Go there and have a look at Names.php as it contains a list of known languages and their prefixes. E.g. you want to add your German project, search Names.php for "Deutsch" and note the prefix "de".

If you know the "right" prefix, edit your database by adding a new line to table interwiki:

iw_prefix language-prefix (e.g. "de" for German), which is listed in Names.php
iw_url URL to your wiki-project (e.g. http://de.example.org/index.php/$1)
iw_local same as above "Adding More"
iw_trans same as above "Adding More"

Now, you can link an article to the same in other languages. Adding [[de:Hauptseite]] on your English Main_Page will create a link "Deutsch" below the toolbox, which leads to the Main_Page of the German wiki (Hauptseite).

Note, that this link is shown in Sidebar's section, only, and not inside of the article. If you want to create a link inside of the text, you have to add a colon previous to the prefix: [[:de:Hauptseite]] or set $wgInterwikiMagic to false.

Exporting the interwiki table from a wiki

The following JavaScript code performs the API query to retrieve the interwiki map of an existing wiki, then displays the SQL INSERT statements to fill the interwiki table on a new wiki. You run it for example by injecting the code through your browser's developer tools, or by placing it inside Special:MyPage/skinname.js and previewing.

function ExtractInterwikiMapTable() {
	$.getJSON(mw.config.get('wgScriptPath') + '/api.php?action=query&meta=siteinfo&siprop=interwikimap&format=json', function(data) {
		var iw_prefix, iw_url, iw_local, iw_api, re_escape = /(')/g, result = '';
		for (var i = 0, iwm = data.query.interwikimap; i < iwm.length; i++) {
			iw_prefix = "'" + iwm[i].prefix.replace(re_escape, '\\$1') + "'";
			iw_url = "'" + iwm[i].url.replace(re_escape, '\\$1') + "'";
			iw_local = (typeof iwm[i].local == 'string') ? '1' : '0';
			iw_api = "'" + (iwm[i].iw_api || '').replace(re_escape, '\\$1') + "'";
			result += 'INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans, iw_api) VALUES ('+iw_prefix+', '+iw_url+', '+iw_local+', 0, '+iw_api+');\n'
		}
		$('<textarea style="width:800px;height:400px;"/>').val(result).appendTo(document.body);
	});
}

$(ExtractInterwikiMapTable);
[[imdbtitle:0389790|Bee Movie]]Bee Movie
[http://www.imdb.com/title/tt0389790 Bee Movie]Bee Movie

Linksearch works for the latter only.

Wikitext using interwiki links isn't always easily transferable between different wikis because they don't consistently use the same interwiki prefixes, or they might not have them at all. Additionally, interwiki links can sometimes mislead users since they don't know when they're being sent to another site.

You can choose between "extiw" and "external text" CSS classes for links, depending on whether you want them to look the same or different. Using just the interwiki link is easier to type, but copying the URL from the webpage is handy. Templates like w:Template:imdb title can be set up to use either an interwiki link with a parameter like "tt0389790" or "0389790", or an external link with a parameter like one of those or the full URL, making it easier to include IMDb references.

Interwiki links can be configured to point to the same wiki they are being rendered from. For example, mw:Manual:Interwiki/ko points to this page. These links are treated identically to internal links and do show up on Special:WhatLinksHere, appear bold if they are a selflink like the above, appear red if the page doesn't exist, etc.

같이 보기