Answers.Body: <p>If I'm understanding you correctly, you want users when they visit your site to have a secondary menu that has links to various points in the article. That would actually be very easy to do in Craft. It's also possible for you to paginate a page, but that would be far more in-depth.</p>
  
  <p>For skip links, you would need to run over the matrix twice. You will also need an anchor matrix block. It can either be a dedicated block for anchor tags, or a header block. You run over it the first time to create your menu:</p>
  
  <pre><code>&lt;ul class="article menu"&gt;
  {% for block in entry.articleMatrix.type('header') %}
      &lt;li&gt;&lt;a href="#{{ block.header|slugify }}"&gt;{{ block.header }}&lt;/a&gt;&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Then later when you are running over your article, you can check for block type and add the id as needed:</p>
  
  <pre><code>{% if block.type == "header" %}
      &lt;h1 id="{{ block.header|slugify }}"&gt;{{ block.header }}&lt;/h1&gt;
  {% endif %}
  </code></pre>
  
  <p>This is a really basic example. It uses <a href="https://gist.github.com/boboldehampsink/7354431">Bob Olde Hampsink's slugify plugin</a> (it uses Craft's built in slug method). It would be better if you could determine (maybe with a drop down field in your block) what level of heading the block is. I suggest you also cache each matrix loop for performance.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T21:20:44.667Z
Answers.Text: Nice answer, Bryan! To further improve this, you could exchange the `replace` filter with Bob Olde Hampsink's [`slugify`](https://gist.github.com/boboldehampsink/7354431) filter, which uses Craft's core slug technology.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T21:25:27.683Z
Answers.Text: Good idea! It's been added.
Answers.UserDisplayName: Bryan Redeagle
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T19:58:11.350Z
Answers.LastActivityDate: 2014-06-25T21:24:45.617Z
Answers.LastEditDate: 2014-06-25T21:24:45.617Z
Answers.UserDisplayName: Bryan Redeagle
Answers.Body: <p>If you just mean to create an anchor-link menu, just use this plugin: <a href="https://github.com/pixelandtonic/Anchors">Anchor</a></p>
  
  <p>.</p>
  
  <p>If you want to create a multi-site article pagination, you could do it like this:</p>
  
  <ul>
  <li>Add a page-break-block to your matrix.  </li>
  <li><p>Get your entry by the slug's segment:</p>
  
  <pre><code>{% set entry = craft.entries.section('section_handle').slug( craft.request.getSegment(2) ) %}
  </code></pre></li>
  <li><p>Add a route which redirects to the template, if an additional segment is added, for example:</p>
  
  <blockquote>
    <p>something/{slug}/{*}</p>
  </blockquote></li>
  <li><p>You could check with a conditional in your template what lastSegment is passed, and depending on it, show parts of your matrix.</p></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T19:42:17.267Z
Answers.Text: I think he's referring to this being on the front-end. I think this because he mentioned a snippet in WordPress (a shortcode methinks).
Answers.UserDisplayName: Bryan Redeagle
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T19:48:55.917Z
Answers.Text: Ah ok, makes sense. I'll edit the answer.
Answers.UserDisplayName: Victor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T19:39:34.650Z
Answers.LastActivityDate: 2014-06-25T20:12:12.867Z
Answers.LastEditDate: 2014-06-25T20:12:12.867Z
Answers.UserDisplayName: Victor
Answers.Body: <p>I'm not sure I fully understand what you are trying to do, but I think this may apply as an option to consider.  Matrix Blocks are Element Types and the {% paginate %} tag works with all Element Types.</p>
  
  <p>So you could treat your blocks as you would a section with entries, and paginate them.  A simple example:</p>
  
  <pre><code>{% paginate entry.articleMatrix.limit(3) as blocks %}
  
    {% for block in blocks %}
  
      {# Display all your blocks output as needed #}
      &lt;div class="block {{ block.type }}"&gt;
        {% include "_partials/blocks/" ~ block.type %}   
      &lt;/div&gt;
  
      {% if paginate.prevUrl %}
      &lt;a href="{{ paginate.prevUrl }}"&gt;Previous Page&lt;/a&gt;
      {% endif %}
  
      {% if paginate.nextUrl %}
          &lt;a href="{{ paginate.nextUrl }}"&gt;Next Page&lt;/a&gt;
      {% endif %}
  
    {% endfor %}
  
  {% endpaginate %}
  </code></pre>
  
  <p><a href="http://buildwithcraft.com/docs/templating/tags#paginate" rel="nofollow">Pagination in the Craft Docs</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T22:59:40.647Z
Answers.LastActivityDate: 2014-06-25T22:59:40.647Z
Answers.UserDisplayName: Ben Parizek
Body: <p>I'm writing some pretty huge articles consisting of multiple (80+) Matrix blocks of various types. They're so long they'd benefit from in-article navigation for skip-links.</p>
  
  <p>WordPress has a plugin called autogen_menu which creates linked navigation from the header hierarchy in a post. You just put in a small snippet where you want the generated nav to go and it generates all the links (and presumably id's on the headers) itself. Has Craft got anything similar, I've not been able to find a plugin that does this?</p>
  
  <p>Or, would this be better outside of Craft entirely and done as JS?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-26T08:39:22.480Z
Comments.Text: Thanks for the answers guys, but they're only doing half of what I mean, and the Matrix route would end up with me having some 140+ blocks on a single page - 80 is already causing slow-down in the UI.
  
  Maybe an example is better:
  
  See here: https://mattwilcox.net/archives/setting-up-a-secure-home-web-server-with-raspberry-pi/
  
  The Menu and links at the top are being automatically generated from the article. That's what I would like.
Comments.UserDisplayName: Matt Wilcox
Tags: <navigation>
Title: Automatic in-page navigation plugin?
ThreadText: # Automatic in-page navigation plugin?
  
  (Asked by: username_0 on 2014-06-25)
  
  I'm writing some pretty huge articles consisting of multiple (80+) Matrix blocks of various types. They're so long they'd benefit from in-article navigation for skip-links.
  
  WordPress has a plugin called autogen\_menu which creates linked navigation from the header hierarchy in a post. You just put in a small snippet where you want the generated nav to go and it generates all the links (and presumably id's on the headers) itself. Has Craft got anything similar, I've not been able to find a plugin that does this?
  
  Or, would this be better outside of Craft entirely and done as JS?
  
  **Tags:** navigation
  
  > **Comments:**
  > **username_0**: Thanks for the answers guys, but they're only doing half of what I mean, and the Matrix route would end up with me having some 140+ blocks on a single page - 80 is already causing slow-down in the UI.  Maybe an example is better:  See here: https://username_0.net/archives/setting-up-a-secure-home-web-server-with-raspberry-pi/  The Menu and links at the top are being automatically generated from the article. That's what I would like.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2014-06-25. Score: 11
  
  If I'm understanding you correctly, you want users when they visit your site to have a secondary menu that has links to various points in the article. That would actually be very easy to do in Craft. It's also possible for you to paginate a page, but that would be far more in-depth.
  
  For skip links, you would need to run over the matrix twice. You will also need an anchor matrix block. It can either be a dedicated block for anchor tags, or a header block. You run over it the first time to create your menu:
  
  ```
  <ul class="article menu">
  {% for block in entry.articleMatrix.type('header') %}
      <li><a href="#{{ block.header|slugify }}">{{ block.header }}</a></li>
  {% endfor %}
  </ul>
  
  ```
  
  Then later when you are running over your article, you can check for block type and add the id as needed:
  
  ```
  {% if block.type == "header" %}
      <h1 id="{{ block.header|slugify }}">{{ block.header }}</h1>
  {% endif %}
  
  ```
  
  This is a really basic example. It uses [Bob Olde Hampsink's slugify plugin](https://gist.github.com/boboldehampsink/7354431) (it uses Craft's built in slug method). It would be better if you could determine (maybe with a drop down field in your block) what level of heading the block is. I suggest you also cache each matrix loop for performance.
  
  > **Comments:**
  > **username_2**: Nice answer, username_1! To further improve this, you could exchange the `replace` filter with Bob Olde Hampsink's [`slugify`](https://gist.github.com/boboldehampsink/7354431) filter, which uses Craft's core slug technology.  
  > **username_1**: Good idea! It's been added.  
  
  ---
  
  ### Answer by username_3 on 2014-06-25. Score: 5
  
  If you just mean to create an anchor-link menu, just use this plugin: [Anchor](https://github.com/pixelandtonic/Anchors)
  
  .
  
  If you want to create a multi-site article pagination, you could do it like this:
  
  * Add a page-break-block to your matrix.
  * Get your entry by the slug's segment:
  
    ```
    {% set entry = craft.entries.section('section_handle').slug( craft.request.getSegment(2) ) %}
  
    ```
  * Add a route which redirects to the template, if an additional segment is added, for example:
  
    > something/{slug}/{\*}
  * You could check with a conditional in your template what lastSegment is passed, and depending on it, show parts of your matrix.
  
  > **Comments:**
  > **username_1**: I think he's referring to this being on the front-end. I think this because he mentioned a snippet in WordPress (a shortcode methinks).  
  > **username_3**: Ah ok, makes sense. I'll edit the answer.  
  
  ---
  
  ### Answer by username_4 on 2014-06-25. Score: 2
  
  I'm not sure I fully understand what you are trying to do, but I think this may apply as an option to consider. Matrix Blocks are Element Types and the {% paginate %} tag works with all Element Types.
  
  So you could treat your blocks as you would a section with entries, and paginate them. A simple example:
  
  ```
  {% paginate entry.articleMatrix.limit(3) as blocks %}
  
    {% for block in blocks %}
  
      {# Display all your blocks output as needed #}
      <div class="block {{ block.type }}">
        {% include "_partials/blocks/" ~ block.type %}   
      </div>
  
      {% if paginate.prevUrl %}
      <a href="{{ paginate.prevUrl }}">Previous Page</a>
      {% endif %}
  
      {% if paginate.nextUrl %}
          <a href="{{ paginate.nextUrl }}">Next Page</a>
      {% endif %}
  
    {% endfor %}
  
  {% endpaginate %}
  
  ```
  
  [Pagination in the Craft Docs](http://buildwithcraft.com/docs/templating/tags#paginate)
  
  
  ---
  
  