Template:FAQItem: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary Tag: Reverted |
mNo edit summary Tag: Reverted |
||
| Line 44: | Line 44: | ||
<!-- Generate a stable anchor ID from the question text --> | <!-- Generate a stable anchor ID from the question text --> | ||
<!-- Generate the anchor --> | |||
<span id="{{anchorencode:{{{question}}}}}"></span> | <span id="{{anchorencode:{{{question}}}}}"></span> | ||
<!-- Store the fragment before entering HTML mode --> | |||
{{#vardefine:frag|{{anchorencode:{{{question}}}}} }} | |||
<html> | <html> | ||
<details class="faq-item"> | <details class="faq-item"> | ||
<summary style="font-weight: bold; font-size:larger;" | <summary style="font-weight: bold; font-size:larger;">{{{question}}}</summary> | ||
<!-- Copy link control ( | <!-- Copy link control (now inside HTML mode, so not escaped) --> | ||
<div style="margin:0.5em 0 1em 0; font-size:smaller; opacity:0.7;"> | <div style="margin:0.5em 0 1em 0; font-size:smaller; opacity:0.7;"> | ||
<a href="#" class="copy-link" data-frag="{{ | <a href="#" class="copy-link" data-frag="{{#var:frag}}"> | ||
Copy link to this question | Copy link to this question | ||
</a> | </a> | ||
</div> | </div> | ||
<blockquote class="faq-answer"> | <blockquote class="faq-answer"> | ||
{{{answer}}} | |||
</blockquote> | </blockquote> | ||
</details> | </details> | ||
<script> | <script> | ||
document.addEventListener('DOMContentLoaded', function() { | document.addEventListener('DOMContentLoaded', function() { | ||
Revision as of 19:56, 26 February 2026
Creates a FAQ item with collapsible details and a permalink
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Question | question | The Question | String | required |
| Answer | answer | The Answer to the question | String | required |
FAQItem usage
- Copy text between the horizontal lines for each Question with Answer
- Put the Question after | question =
- Put the Answer after | answer =
{{FAQItem
| question =
| answer =
}}
The FAQItem will render as it appears below this line.
{{#vardefine:frag|{{{question}}} }}