summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/os
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/functions/os')
-rw-r--r--docs/content/en/functions/os/FileExists.md41
-rw-r--r--docs/content/en/functions/os/Getenv.md61
-rw-r--r--docs/content/en/functions/os/ReadDir.md51
-rw-r--r--docs/content/en/functions/os/ReadFile.md40
-rw-r--r--docs/content/en/functions/os/Stat.md31
-rw-r--r--docs/content/en/functions/os/_index.md12
6 files changed, 0 insertions, 236 deletions
diff --git a/docs/content/en/functions/os/FileExists.md b/docs/content/en/functions/os/FileExists.md
deleted file mode 100644
index b8104a066..000000000
--- a/docs/content/en/functions/os/FileExists.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-title: os.FileExists
-description: Reports whether the file or directory exists.
-categories: []
-keywords: []
-action:
- aliases: [fileExists]
- related:
- - functions/os/Getenv
- - functions/os/ReadDir
- - functions/os/ReadFile
- - functions/os/Stat
- returnType: bool
- signatures: [os.FileExists PATH]
-aliases: [/functions/fileexists]
----
-
-The `os.FileExists` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`](/getting-started/configuration#contentdir). A leading path separator (`/`) is optional.
-
-With this directory structure:
-
-```text
-content/
-├── about.md
-├── contact.md
-└── news/
- ├── article-1.md
- └── article-2.md
-```
-
-The function returns these values:
-
-```go-html-template
-{{ fileExists "content" }} → true
-{{ fileExists "content/news" }} → true
-{{ fileExists "content/news/article-1" }} → false
-{{ fileExists "content/news/article-1.md" }} → true
-{{ fileExists "news" }} → true
-{{ fileExists "news/article-1" }} → false
-{{ fileExists "news/article-1.md" }} → true
-```
diff --git a/docs/content/en/functions/os/Getenv.md b/docs/content/en/functions/os/Getenv.md
deleted file mode 100644
index 084d498ce..000000000
--- a/docs/content/en/functions/os/Getenv.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: os.Getenv
-description: Returns the value of an environment variable, or an empty string if the environment variable is not set.
-categories: []
-keywords: []
-action:
- aliases: [getenv]
- related:
- - functions/os/FileExists
- - functions/os/ReadDir
- - functions/os/ReadFile
- - functions/os/Stat
- returnType: string
- signatures: [os.Getenv VARIABLE]
-aliases: [/functions/getenv]
-toc: true
----
-
-## Security
-
-By default, when using the `os.Getenv` function Hugo allows access to:
-
-- The `CI` environment variable
-- Any environment variable beginning with `HUGO_`
-
-To access other environment variables, adjust your site configuration. For example, to allow access to the `HOME` and `USER` environment variables:
-
-{{< code-toggle file=hugo >}}
-[security.funcs]
-getenv = ['^HUGO_', '^CI$', '^USER$', '^HOME$']
-{{< /code-toggle >}}
-
-Read more about Hugo's [security policy].
-
-[security policy]: /about/security-model/#security-policy
-
-## Examples
-
-```go-html-template
-{{ getenv "HOME" }} → /home/victor
-{{ getenv "USER" }} → victor
-```
-
-You can pass values when building your site:
-
-```sh
-MY_VAR1=foo MY_VAR2=bar hugo
-
-OR
-
-export MY_VAR1=foo
-export MY_VAR2=bar
-hugo
-```
-
-And then retrieve the values within a template:
-
-```go-html-template
-{{ getenv "MY_VAR1" }} → foo
-{{ getenv "MY_VAR2" }} → bar
-```
diff --git a/docs/content/en/functions/os/ReadDir.md b/docs/content/en/functions/os/ReadDir.md
deleted file mode 100644
index 63af850b7..000000000
--- a/docs/content/en/functions/os/ReadDir.md
+++ /dev/null
@@ -1,51 +0,0 @@
----
-title: os.ReadDir
-description: Returns an array of FileInfo structures sorted by file name, one element for each directory entry.
-categories: []
-keywords: []
-action:
- aliases: [readDir]
- related:
- - functions/os/FileExists
- - functions/os/Getenv
- - functions/os/ReadFile
- - functions/os/Stat
- returnType: os.FileInfo
- signatures: [os.ReadDir PATH]
-aliases: [/functions/readdir]
----
-
-The `os.ReadDir` function resolves the path relative to the root of your project directory. A leading path separator (`/`) is optional.
-
-With this directory structure:
-
-```text
-content/
-├── about.md
-├── contact.md
-└── news/
- ├── article-1.md
- └── article-2.md
-```
-
-This template code:
-
-```go-html-template
-{{ range readDir "content" }}
- {{ .Name }} → {{ .IsDir }}
-{{ end }}
-```
-
-Produces:
-
-```html
-about.md → false
-contact.md → false
-news → true
-```
-
-Note that `os.ReadDir` is not recursive.
-
-Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
-
-For more information on using `readDir` and `readFile` in your templates, see [Local File Templates](/templates/files).
diff --git a/docs/content/en/functions/os/ReadFile.md b/docs/content/en/functions/os/ReadFile.md
deleted file mode 100644
index 654e300ac..000000000
--- a/docs/content/en/functions/os/ReadFile.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-title: os.ReadFile
-description: Returns the contents of a file.
-categories: []
-keywords: []
-action:
- aliases: [readFile]
- related:
- - functions/os/FileExists
- - functions/os/Getenv
- - functions/os/ReadDir
- - functions/os/Stat
- returnType: string
- signatures: [os.ReadFile PATH]
-aliases: [/functions/readfile]
----
-
-The `os.ReadFile` function attempts to resolve the path relative to the root of your project directory. If a matching file is not found, it will attempt to resolve the path relative to the [`contentDir`](/getting-started/configuration#contentdir). A leading path separator (`/`) is optional.
-
-With a file named README.md in the root of your project directory:
-
-```text
-This is **bold** text.
-```
-
-This template code:
-
-```go-html-template
-{{ readFile "README.md" }}
-```
-
-Produces:
-
-```html
-This is **bold** text.
-```
-
-Note that `os.ReadFile` returns raw (uninterpreted) content.
-
-For more information on using `readDir` and `readFile` in your templates, see [Local File Templates](/templates/files).
diff --git a/docs/content/en/functions/os/Stat.md b/docs/content/en/functions/os/Stat.md
deleted file mode 100644
index 6b6f668de..000000000
--- a/docs/content/en/functions/os/Stat.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: os.Stat
-description: Returns a FileInfo structure describing a file or directory.
-categories: []
-keywords: []
-action:
- aliases: []
- related:
- - functions/os/FileExists
- - functions/os/Getenv
- - functions/os/ReadDir
- - functions/os/ReadFile
- returnType: os.FileInfo
- signatures: [os.Stat PATH]
-aliases: [/functions/os.stat]
----
-
-The `os.Stat` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`](/getting-started/configuration#contentdir). A leading path separator (`/`) is optional.
-
-```go-html-template
-{{ $f := os.Stat "README.md" }}
-{{ $f.IsDir }} → false (bool)
-{{ $f.ModTime }} → 2021-11-25 10:06:49.315429236 -0800 PST (time.Time)
-{{ $f.Name }} → README.md (string)
-{{ $f.Size }} → 241 (int64)
-
-{{ $d := os.Stat "content" }}
-{{ $d.IsDir }} → true (bool)
-```
-
-Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
diff --git a/docs/content/en/functions/os/_index.md b/docs/content/en/functions/os/_index.md
deleted file mode 100644
index c080d0092..000000000
--- a/docs/content/en/functions/os/_index.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: OS functions
-linkTitle: os
-description: Template functions to interact with the operating system.
-categories: []
-keywords: []
-menu:
- docs:
- parent: functions
----
-
-Use these functions to interact with the operating system.