orchidhq / Orchid

Build and deploy beautiful documentation sites that grow with you
https://orchid.run
GNU General Public License v3.0
513 stars 53 forks source link

Access the project version #318

Closed DanySK closed 4 years ago

DanySK commented 4 years ago

Hi, is there any way I can access the current version when writing a wiki file? Ideally, I'd like it to work inside summary.md. I could go manually and write a Gradle task that substitutes some token with the current project version, but I'd prefer not to have to hack it this way

thanks

cjbrooks12 commented 4 years ago

You can use {{ site.version }} to get your project's version, and {{ site.orchidVersion }} to get the version of Orchid.

In general, if you're writing Gradle tasks to preprocess your content or anything like that, you're probably doing it wrong, and you could either use existing Orchid functionality or make some kind of custom plugin to do what you want in a better way.

DanySK commented 4 years ago

Thanks @cjbrooks12 Are these calls documented anywhere?

Anyway, if used within summary.md in a wiki, produces { } as output. Works within "normal" pages, though.

cjbrooks12 commented 4 years ago

It's available on any content page that is precompiled, which happens when the page has a Front Matter header (even if it's empty). By adding the pairs of triple-dashes to the top of the wiki page, it will be precompiled with Pebble before it gets processed as Markdown, and you can inject anything you want in there. See docs on Precompiling for more on that.

As for these properties, they're not specifically or thoroughly documented, but these two properties are mentioned in one of the tutorials here.

DanySK commented 4 years ago

Works like a charm. Thanks.