Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create: Use archetype template as-is as a Go template #3605

Merged
merged 2 commits into from
Jun 18, 2017

Commits on Jun 18, 2017

  1. create: Use archetype template as-is as a Go template

    This commit removes the fragile front matter decoding, and takes the provided archetype file as-is and processes it as a template.
    
    This also means that we no longer will attempt to fill in default values for `title` and `date`.
    
    The upside is that it is now easy to create these values in a dynamic way:
    
    ```toml
    +++
    title = {{ .Name | title }}
    date = {{ .Date }}
    draft = true
    +++
    ```
    
    You can currently use all of Hugo's template funcs, but the data context is currently very shallow:
    
    * `.Type` gives the archetype kind provided
    * `.Name` gives the target file name without extension.
    * `.Path` gives the target file name
    * `.Date` gives the current time as RFC3339 formatted string
    
    The above  will probably be extended in gohugoio#1629.
    
    Fixes gohugoio#452
    Updates gohugoio#1629
    bep committed Jun 18, 2017
    Configuration menu
    Copy the full SHA
    33ead05 View commit details
    Browse the repository at this point in the history
  2. Use source.File

    bep committed Jun 18, 2017
    Configuration menu
    Copy the full SHA
    4073f61 View commit details
    Browse the repository at this point in the history