Skip to content

Any way to specify metadata within a razor page rather than using yaml/json? #132

Answered by daveaglick
Khitiara asked this question in Q&A
Discussion options

You must be logged in to vote

Not really. The Razor engine exists at a level "higher" than the Statiq document model. Document metadata can flow up through the document to be exposed in the Razor template via the Document property (and in some cases Model - though Document is preferred). But we can't flow metadata back down to the document through the Razor template.

Part of the reasoning here is that it would be confusing. Razor only executes near the very end of the Statiq process in the post-process phase so even if we did allow metadata to be added to a document from within Razor, it wouldn't really be available to much else after the Razor engine in done processing.

On the other hand, there's no reason you can't …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Khitiara
Comment options

@daveaglick
Comment options

@Khitiara
Comment options

@daveaglick
Comment options

@daveaglick
Comment options

Answer selected by Khitiara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants