1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-27 10:44:39 +01:00
gojekyll/pages/static_file.go
2017-06-29 10:13:25 -04:00

26 lines
475 B
Go

package pages
import (
"io"
"os"
)
// StaticFile is a static file.
type StaticFile struct {
file
}
// Static is in the File interface.
func (p *StaticFile) Static() bool { return true }
// Write returns a bool indicating that the page is a static page.
func (p *StaticFile) Write(_ RenderingContext, w io.Writer) error {
in, err := os.Open(p.filename)
if err != nil {
return err
}
defer in.Close() // nolint: errcheck, gas
_, err = io.Copy(w, in)
return err
}