GitHub

<DocfyPreviousAndNextPage>

This component yields the previous and next page (PageMetadata) if it exists. The component accepts a single argument called scope. It is used to narrow the pages that it can link as previous and next.

Scoping the pages is useful if you are building different sections of your docs site; for example, one section is "Documentation", and another is "Tutorials". This feature would prevent linking to a page in tutorials from a documentation page.

Examples

This example passes the argument @scope to the component.

<DocfyPreviousAndNextPage @scope="docs" as |previous next|>
  <div>
    {{#if previous}}
      <div class="text-sm">Previous</div>

      <DocfyLink @to={{previous.url}} class="text-xl text-blue-500">
        {{previous.title}}
      </DocfyLink>
    {{/if}}
  </div>
  <div>
    {{#if next}}
      <div class="text-sm">Next</div>

      <DocfyLink @to={{next.url}} class="text-xl text-blue-500">
        {{next.title}}
      </DocfyLink>
    {{/if}}
  </div>
</DocfyPreviousAndNextPage>
<DocfyPreviousAndNextPage as |previous next|>
  <div>
    {{#if previous}}
      <div class="text-sm">Previous</div>

      <DocfyLink @to={{previous.url}} class="text-xl text-blue-500">
        {{previous.title}}
      </DocfyLink>
    {{/if}}
  </div>
  <div>
    {{#if next}}
      <div class="text-sm">Next</div>

      <DocfyLink @to={{next.url}} class="text-xl text-blue-500">
        {{next.title}}
      </DocfyLink>
    {{/if}}
  </div>
</DocfyPreviousAndNextPage>

API

Argument Description Type Default Value
@scope Filter links by a scope name string | undefined