0
我正在嘗試爲引導標籤創建簡碼。我有以下HTML結構,Bootstrap標籤爲Hugo Shortcodes
<nav class="nav nav-tabs" id="myTab" role="tablist">
<a class="nav-item nav-link" id="{{ .Get `id` }}-tab" data-toggle="tab" href="#{{ .Get `id` }}" role="tab" aria-controls="{{ .Get `id` }}">
{{ .Get "title" }}
</a>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade" id="{{ .Get `id` }}" role="tabpanel" aria-labelledby="{{ .Get `id` }}-tab">
{{ .Inner }}
</div>
</div>
該結構還包含Hugo佔位符。但代碼,這是內部部分,
<a class="nav-item nav-link" id="{{ .Get `id` }}-tab" data-toggle="tab" href="#{{ .Get `id` }}" role="tab" aria-controls="{{ .Get `id` }}">
{{ .Get "title" }}
</a>
需要多次與相應內容的div是沿,
<div class="tab-pane fade" id="{{ .Get `id` }}" role="tabpanel" aria-labelledby="{{ .Get `id` }}-tab">
{{ .Inner }}
</div>
現在的問題是,我必須通過id
如內部結構的爭論,應該從其父母分離。我應該能夠使用以下方式的短代碼:
{% tabs %}
{% tab id = "tab-1" title = "Tab One" %}
Content in Tab 1
{% \tab %}
{% tab id = "tab-2" title = "Tab Two" %}
Content in Tab 2
{% \tab %}
{% \tabs %}
我該如何做到這一點?