Skip to content

Instantly share code, notes, and snippets.

@emmajane
Last active August 29, 2015 14:01
Show Gist options
  • Save emmajane/ca240e6dfa20eb42487a to your computer and use it in GitHub Desktop.
Save emmajane/ca240e6dfa20eb42487a to your computer and use it in GitHub Desktop.
title slug
Sources
sources

By default, Sculpin assumes that there will be a source/ directory in your project root containing all of the content for your site.

If you are working from a project template, such as the Getting Started guide describes, your project will already have a source directory. If you are starting your project from scratch, you will need to create a source directory for the content of your site. The source directory should be placed in the root, or top level, directory for your project.

|-- source/

File Format for Source Files

Content source files for Sculpin projects are markdown files, with an optional YAML frontmatter header. The YAML frontmatter is delimited by ---. For example:

---
title: Hello World
---

This is the content of my page.

The YAML frontmatter is parsed and injected into every page rendering and is accessible as page.KEY.

If you are working from a completely empty project, and there are no views formatting your source files, the content of your YAML header will be completely ignored. This also, however, means that your page title will not be printed. You can print the title to the page by using simple markdown, but this will not be used for the HTML page title, which isn't very SEO-friendly.

# Hello World

This is the content of my page.

All source files will be converted to HTML files when a static copy of your site is generated.

Source Directories

You may divide your content into sub-directories within the directory source. You may want to divide your content into directories based on their content type. For example, you may want your blog posts to appear with the URL blog.

|-- source/
|  |-- blog/
|     |-- 2014-02-21-first-post.md
|     |-- 2014-03-21-time-management.md
|  |-- about.md
|  |-- contact.md

If you want to store your source material in a folder with a different name than the output directory, use a preceding underscore on the file name to keep the directories tucked out of the way.

|-- source/
|  |-- _posts/
|  |-- _pages/

For more information on generating

Deep Frontmatter YAML Structures

Sculpin will read deep structures in YAML frontmatter. Just use a . to indicate that you want to descend into a structure. For example:

---
layout: default
something:
    here:
        very: deep
        also: deep
---

{% verbatim %}We can reference `{{ page.something.here.also }} === deep`.{% endverbatim %}

Rendered Source Files

Your markdown files will automatically be converted to .html files when generating the output for your site.

For example: let's say you have only one source file, index.md:

|-- source/
   `-- index.md

After generating your content for the dev environment with the command sculpin generate --watch --server, you will have the following directory structure:

|-- source/
   `-- index.md
|-- output_dev/
   `-- index.html

After generating your content for the production environment with the command sculpin generate --env=prod, you will have the following directory structure:

|-- source/
   `-- index.md
|-- output_dev/
   `-- index.html
|-- output_prod/
   `-- index.html

You should upload the contents of the directory output_prod to your server. You do not need to upload the contents of the source directory, or the developer environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment