Include the canonical path to the current document when rendering.#25
Open
ojacobson wants to merge 1 commit intozacharyvoase:masterfrom
ojacobson:document-path
Open
Include the canonical path to the current document when rendering.#25ojacobson wants to merge 1 commit intozacharyvoase:masterfrom ojacobson:document-path
ojacobson wants to merge 1 commit intozacharyvoase:masterfrom
ojacobson:document-path
Conversation
…ocument. Given a document in WIKI_ROOT/foo/bar.md, it's tricky to reconsruct "foo/bar" or "foo/bar.html" or "foo/bar.md" from the breadcrumbs. A similar bit of context (named "directory") is already passed to directory templates; now markdoc passes the document path to the document template too. I'm using this in my own markdoc instance to generate "page history" links (to github) for each page.
Author
|
I'm using this to generate the Github links in the footer of, for example, http://grimoire.ca/dev/builds. The relevant template bit looks like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Given a document in WIKI_ROOT/foo/bar.md, it's tricky to reconsruct "foo/bar" or "foo/bar.html" or "foo/bar.md" from the breadcrumbs. A similar bit of context (named "directory") is already passed to directory templates; now markdoc passes the document path to the document template too.
I'm using this in my own markdoc instance to generate "page history" links (to github) for each page.
I'm not sure my implementation is entirely correct; while my experiments only show that
pathis a wiki-root-relative path (given~/bliki/wiki/git/survival.md,pathwas alwaysgit/survival.md) other code makes me suspect that it's possible forpathto be absolute. Needs the opinion of someone with more experience with this code than I have.