Jump to content

Help:Section/Editing sections of included templates/ja

From mediawiki.org
This page is a translated version of the page Help:Section/Editing sections of included templates and the translation is 30% complete.

Editing sections of included templates

{{{1}}}
詳細については 参照読み込み を参照してください

You can edit sections within included pages or templates. Clicking the edit link for a section takes you to the edit page of the separate page. This is also known as 参照読み込み .

The size of the section within the included page or template is determined by the headings in the main page where it is included. When a page is transcluded, all the text on the source page will be transcluded/included in the target page. This includes text placed before the first section heading on the source page. Consequently, if the edit link on the first section header of the transcluded text is clicked on the source page, section editing will open and the text before the first section header and the text of the next section will not be shown in the editor. In order to edit the entire source page's text, the editor must exit the editor when taken to the source page, and then click the edit link at the top of the source page. Similarly, if there are texts after the template tag without a heading, you need to click the headings before the template to edit it. This section shows how it works. To ensure clarity and consistency in rendered source pages that are transcluded to another page, follow these guidelines:

  • テンプレートの構造Avoid placing any text before the first section heading within a template.
  • 節の処理After using a template with sections, start a new section on the source page. This prevents conflicts between template sections and source page sections.

Additionally, consider the following practices for managing templates effectively:

  • テンプレートの見出し - Sometimes it's helpful to start a template with a heading, even if it's just one section. これにより編集が簡単になります。
  • Parameter use - When editing templates, remember parameters, such as {{{1}}}, are changed in the target page, not directly in the template. Although this may not be immediately apparent in the rendered page, providing explanatory text or an additional edit link can enhance user understanding.
  • __NOEDITSECTION__ タグThe __NOEDITSECTION__ behavior switch affects the template and any pages it's added to, along with other templates on the same page. Instead, consider replacing MediaWiki section header markup with HTML header markup within the template, causing the headers to remain visually consistent while avoiding recognition as editable sections. This approach eliminates the need for __NOEDITSECTION__ within the template.

For example, think of a template structured as follows:

== テンプレートの見出し1 ==
本文
=== テンプレートの見出し2 ===
本文

To prevent "edit section" links from appearing when transcluding a template, add __NOEDITSECTION__ within the template's code. However, this suppresses all "edit section" links on pages where the template is used. Alternatively, structuring the template with HTML heading tags (‎<h2>, ‎<h3>, etc.) achieves the same visual effect without affecting other sections' edit links on transcluding pages.

<h2>テンプレートの見出し1</h2>
本文
<h3>テンプレートの見出し2</h3>
本文