github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/readfile.md (about)

     1  ---
     2  title: readFile
     3  description: Reads a file from disk relative to the current project working directory and returns a string.
     4  godocref:
     5  date: 2017-02-01
     6  publishdate: 2017-02-01
     7  lastmod: 2017-04-30
     8  categories: [functions]
     9  menu:
    10    docs:
    11      parent: "functions"
    12  keywords: [files]
    13  signature: ["readFile PATH"]
    14  workson: []
    15  hugoversion:
    16  relatedfuncs: [readDir]
    17  deprecated: false
    18  aliases: []
    19  ---
    20  
    21  Note that the filename must be relative to the current project working directory, or the project's `/content` folder. 
    22  
    23  So, if you have a file with the name `README.txt` in the root of your project with the content `Hugo Rocks!`:
    24  
    25  ```
    26  {{readFile "README.txt"}} → "Hugo Rocks!"
    27  ```
    28  
    29  If you receive a "file doesn't exist" error with a path listed, do take note that the path is the last one checked by the function, and may not accurately reflect your target. You should generally double-check your path for mistakes.
    30  
    31  For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
    32  
    33  [local]: /templates/files/