Skip to content

Reliable links to source files #1274

@dhbradshaw

Description

@dhbradshaw

I'm trying to add an edit link and icon (next to the print icon and the optional git icon on the top right of each page).

The goal is to have that link point to the source markdown file when possible. So far, I've gotten almost there but not quite using

href="{{git_repository_url}}/tree/master/src/{{path}}".

This seems to work for every page -- except for the front page! In this case, the template path variable resolves to index.md, but there isn't actually an index.md in the source folder so the link gets a 404.

(I looked into special casing this, checking for path == index.md and then fixing it, but unfortunately default handlebars doesn't accept equality checks in if statements.)

Any thoughts on how to embed more reliable source file links?

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