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 33% complete.

Editing sections of included templates

This section appears in Help:Section .

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 section (transcluded from Help:Section/Editing sections of included templates ) shows how it works.

The size of the section within the included page or template is determined by the headings in the main page where it is included. Also, texts before the first heading of the separate page is part of the section, but clicking its edit link won't show its text. 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 parent pages, follow these guidelines:

  • テンプレートの構造 - Avoid placing any text before the first heading within a template.
  • 節の処理 - After using a template with sections, start a new section on the parent page. This prevents conflicts between template sections and parent 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 calling 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__ tag 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>
 本文