github.com/rabbouni145/gg@v0.47.1/docs/content/en/variables/files.md (about) 1 --- 2 title: File Variables 3 linktitle: 4 description: "You can access filesystem-related data for a content file in the `.File` variable." 5 date: 2017-02-01 6 publishdate: 2017-02-01 7 lastmod: 2017-02-01 8 categories: [variables and params] 9 keywords: [files] 10 draft: false 11 menu: 12 docs: 13 parent: "variables" 14 weight: 40 15 weight: 40 16 sections_weight: 40 17 aliases: [/variables/file-variables/] 18 toc: false 19 --- 20 21 {{% note "Rendering Local Files" %}} 22 For information on creating shortcodes and templates that tap into Hugo's file-related feature set, see [Local File Templates](/templates/files/). 23 {{% /note %}} 24 25 The `.File` object contains the following fields: 26 27 .File.Path 28 : the original relative path of the page (e.g., `content/posts/foo.en.md`) 29 30 .File.LogicalName 31 : the name of the content file that represents a page (e.g., `foo.en.md`) 32 33 .File.TranslationBaseName 34 : the filename without extension or optional language identifier (e.g., `foo`) 35 36 .File.BaseFileName 37 : the filename without extension (e.g., `foo.en`) 38 39 .File.Ext 40 : the file extension of the content file (e.g., `md`); this can also be called using `.File.Extension` as well. Note that it is *only* the extension without `.`. 41 42 .File.Lang 43 : the language associated with the given file if Hugo's [Multilingual features][multilingual] are enabled (e.g., `en`) 44 45 .File.Dir 46 : given the path `content/posts/dir1/dir2/`, the relative directory path of the content file will be returned (e.g., `posts/dir1/dir2/`) 47 48 [Multilingual]: /content-management/multilingual/