package create
import "github.com/gohugoio/hugo/create"
Package create provides functions to create new content.
Index ¶
- Constants
- func NewContent( ps *helpers.PathSpec, siteFactory func(filename string, siteUsed bool) (*hugolib.Site, error), kind, targetPath string) error
- type ArchetypeFileData
Constants ¶
const (
ArchetypeTemplateTemplate = `---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
draft: true
---
`
)
Functions ¶
func NewContent ¶
func NewContent( ps *helpers.PathSpec, siteFactory func(filename string, siteUsed bool) (*hugolib.Site, error), kind, targetPath string) error
NewContent creates a new content file in the content directory based upon the given kind, which is used to lookup an archetype.
Types ¶
type ArchetypeFileData ¶
type ArchetypeFileData struct { // The archetype content type, either given as --kind option or extracted // from the target path's section, i.e. "blog/mypost.md" will resolve to // "blog". Type string // The current date and time as a RFC3339 formatted string, suitable for use in front matter. Date string // The Site, fully equipped with all the pages etc. Note: This will only be set if it is actually // used in the archetype template. Also, if this is a multilingual setup, // this site is the site that best matches the target content file, based // on the presence of language code in the filename. Site *hugolib.Site // The target content file. Note that the .Content will be empty, as that // has not been created yet. *source.File }
ArchetypeFileData represents the data available to an archetype template.
Source Files ¶
content.go content_template_handler.go
- Version
- v0.25.1
- Published
- Jul 10, 2017
- Platform
- darwin/amd64
- Imports
- 13 packages
- Last checked
- 30 minutes ago –
Tools for package owners.