Skip to content

Extend xref macro to support referencing a page by page ID #69

@mojavelinux

Description

@mojavelinux

Each resource in the sitemap of a Middleman site has a page ID, whether implicit or explicit. The page ID can be used to create a reference to a resource. In a template context, the url_for helper is used for this purpose. Extend the AsciiDoc xref macro to support create page references by page ID in an AsciiDoc document, effectively emulating the behavior of the url_for helper.

This extended behavior needs to be distinguished from a normal inter-document xref. This can either by done by:

a) requiring the page ID to be prefixed with /, or
b) requiring a normal inter-document xref to be prefixed with ./.

Here's an example of a page reference under proposal a).

xref:/about#[]

Here's an example of a page reference under proposal b)

xref:about#[]

Another idea is to require the extension, .adoc, to make a normal inter-document xref. This works since the page ID does not include the extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions