From 04889a5ee6247060cef4bde133a013ce7d4e3b61 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Wed, 18 May 2016 21:07:06 +0200 Subject: [PATCH] docs: Document .File variables for pages Fixes #2154. --- docs/content/templates/variables.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/content/templates/variables.md b/docs/content/templates/variables.md index a8e779cbc..953ba5cb6 100644 --- a/docs/content/templates/variables.md +++ b/docs/content/templates/variables.md @@ -161,6 +161,20 @@ Also available is `.Site` which has the following: **.Site.BuildDrafts** A boolean (Default: false) to indicate whether to build drafts. Defined in the site configuration.
**.Site.Data** Custom data, see [Data Files](/extras/datafiles/).
+## File Variables + +The `.File` variable gives you additional information of a page. + +> **Note:** `.File` is only accessible on *Pages* but **not** on *Nodes* (like the homepage and list pages). + +Available are the following attributes: + +**.File.Path** The original relative path of the page, e.g. `content/posts/foo.md`
+**.File.LogicalName** The name of the content file that represents a page, e.g. `foo.md`
+**.File.BaseFileName** The filename without extension, e.g. `foo`
+**.File.Ext** or **.File.Extension** The file extension of the content file, e.g. `md`
+**.File.Dir** Given the path `content/posts/dir1/dir2/`, the relative directory path of the content file will be returned, e.g. `posts/dir1/dir2/`
+ ## Hugo Variables Also available is `.Hugo` which has the following: