91 lines
3.2 KiB
Plaintext
91 lines
3.2 KiB
Plaintext
== Chapter 2: Directory Layout
|
|
|
|
If you followed the Quick Start in the last chapter, you have a Jekyll site on
|
|
your local machine. Let's take a closer look at it and see what makes it tick.
|
|
The file layout should look something like this:
|
|
|
|
----
|
|
.
|
|
|-- _config.yml
|
|
|-- _layouts
|
|
| |-- default.html
|
|
| `-- post.html
|
|
|-- _posts
|
|
| |-- 2007-10-29-why-every-programmer-should-play-nethack.textile
|
|
| `-- 2009-04-26-barcamp-boston-4-roundup.textile
|
|
|-- _site
|
|
|-- images
|
|
| `-- logo.png
|
|
`-- index.html
|
|
----
|
|
|
|
Notice that some of the files and directories begin with an underscore. These
|
|
have special meaning to Jekyll. The underscore ensures that they will not
|
|
interfere with the rest of your site's normal content. It also means that if
|
|
any of your normal files start with an underscore, they will cause problems,
|
|
so try to avoid this.
|
|
|
|
=== _config.yml
|
|
|
|
This file stores configuration data. A majority of these options can be
|
|
specified from the command line executable but it's easier to throw them in
|
|
here so you don't have to type them out every time. Detailed explanations of
|
|
configuration directives can be found in Chapter X.
|
|
|
|
=== _layouts
|
|
|
|
Files in this directory represent templates that can be used to wrap converted
|
|
pages. Layouts are defined on a page-by-page basis in the YAML front matter.
|
|
The liquid tag +{{ content }}+ specifies where the content will be placed
|
|
during the conversion process.
|
|
|
|
=== _posts
|
|
|
|
If you're using Jekyll as a blog engine, this is where you'll place your blog
|
|
posts. A post's filename contains several pieces of data, so you must be very
|
|
careful about how these files are named. The filename format is:
|
|
+YEAR-MONTH-DATE-SLUG.MARKUP+. The YEAR must be four numbers and the MONTH and
|
|
DATE must be two numbers each. The SLUG is what will appear in the URL. The
|
|
MARKUP tells Jekyll the format of the post. The date and slug will be used
|
|
along with any permalink options you specify (See Chapter X) to construct the
|
|
final URL of the post.
|
|
|
|
=== _site
|
|
|
|
This is where the generated site will be placed (by default) once Jekyll is
|
|
done transforming it. If you're using version control, you'll want to add this
|
|
directory to the list of files to be ignored.
|
|
|
|
=== Normal Files with YAML Front Matter
|
|
|
|
All files outside of the special underscore directories and that do not
|
|
themselves begin with an underscore will be scanned by Jekyll and subjected to
|
|
conversion if they contain any YAML front matter.
|
|
|
|
=== Everything Else
|
|
|
|
Any files and directories that do not fall into one of the above categories
|
|
will be copied to the static site as-is without modification. In this example,
|
|
+images/logo.png+ will be copied to the same location in the generated site.
|
|
|
|
|
|
|
|
|
|
h2. Running Jekyll
|
|
|
|
Usually this is done through the @jekyll@ executable, which is installed with
|
|
the gem. In order to get a server up and running with your Jekyll site, run:
|
|
|
|
@jekyll --server@
|
|
|
|
and then browse to http://0.0.0.0:4000. There's plenty of [[configuration
|
|
options|Configuration]] available to you as well.
|
|
|
|
On Debian or Ubuntu, you may need to add @/var/lib/gems/1.8/bin/@ to your path.
|
|
|
|
h2. Deployment
|
|
|
|
Since Jekyll simply generates a folder filled with HTML files, it can be
|
|
served using practically any available web server out there. Please check the
|
|
[[Deployment]] page for more information regarding specific scenarios.
|