mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-09 23:45:25 +02:00
create counter for header-anchors
This commit is contained in:
parent
07927ccb53
commit
eccf0be38c
2 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<h{{ level }} id="{{ text | urlify }}" class="block-header block-header--{{ level }} block-header--anchor">
|
||||
<a href="#{{ text | urlify }}">
|
||||
<h{{ level }} id="{{ linkNumber }}-{{ text | urlify }}" class="block-header block-header--{{ level }} block-header--anchor">
|
||||
<a href="#{{ linkNumber }}-{{ text | urlify }}">
|
||||
{{ text }}
|
||||
</a>
|
||||
</h{{ level }}>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'layout.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% set linkNumber = 0 %}
|
||||
<article class="page" data-module="page">
|
||||
<header class="page__header">
|
||||
<div class="page__header-nav">
|
||||
|
@ -37,6 +38,10 @@
|
|||
{# Skip first header, because it is already showed as a Title #}
|
||||
{% if not (loop.first and block.type == 'header') %}
|
||||
{% if block.type in ['paragraph', 'header', 'image', 'code', 'list', 'delimiter', 'table', 'warning', 'checklist', 'linkTool', 'raw', 'embed'] %}
|
||||
{# Create the counter to make header-achors different. #}
|
||||
{% if (block.type == 'header') %}
|
||||
{% set linkNumber = linkNumber + 1 %}
|
||||
{% endif %}
|
||||
<div class="page__content-block">
|
||||
{% include './blocks/' ~ block.type ~ '.twig' with block.data %}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue