Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 234 lines (183 sloc) 13.359 kb

Configuration

Acrylamid's configuration is read from conf.py inside your current working dir. If a given value is not set it will be derived from acrylamid.defaults.

A basic configuration looks like this (This file is directly executed as python script and therefore must be valid python code!):

SITENAME = 'A descriptive blog title'
WWW_ROOT = 'http://example.com/'

AUTHOR = 'Anonymous'
EMAIL = 'mail@example.com'

FILTERS = ['markdown+codehilite(css_class=highlight)', 'hyphenate', 'h1']
VIEWS = {
    '/': {'filters': 'summarize', 'view': 'index',
          'pagination': '/page/:num'},

    '/:year/:slug/': {'view': 'entry'},

    '/tag/:name/': {'filters': 'summarize', 'view':'tag',
                    'pagination': '/tag/:name/:num'},

    '/atom/': {'filters': ['h2', 'nohyphenate'], 'view': 'atom'},
    '/rss/': {'filters': ['h2', 'nohyphenate'], 'view': 'rss'},

    '/tag/:name/atom/': {'filters': ['h2', 'nohyphenate'], 'view': 'atompertag'},
    '/tag/:name/rss/': {'filters': ['h2', 'nohyphenate'], 'view': 'rsspertag'},

    '/articles/': {'view': 'articles'},
}

ENGINE =  'acrylamid.templates.jinja2.Environment'
PERMALINK_FORMAT = '/:year/:slug/index.html'
DATE_FORMAT = '%d.%m.%Y, %H:%M'

Each key-value pair (except views [1]) is available during :doc:`templating`.

System Message: ERROR/3 (<string>, line 41); backlink

Unknown interpreted text role "doc".

See the respective documentation for your templating engine for more details on how to use the templating languages: jinja2 Template Designer Documentation, Mako Documentation.

All the settings identifiers must be set in caps, otherwise they will not be processed. This file is processed within a namespace that contains default values for almost every parameter. This allows something like OUTPUT_IGNORE += ['foo'] and makes it more DRY (except VIEWS).

[1] views is a dictionary mapping of view name to view instance and is not available in conf but env, so you can test for a given view with if 'entry' in env.views.

Here is a list of settings for acrylamid, regarding the different features.

Basic settings

Variable name (default value) Description
SITENAME ('A descriptive blog title') The name of your blog. It's displayed in the <title>-block.
AUTHOR ('Anonymous') First author of this blog, can be overwritten in the entry YAML-header.
EMAIL ('info@example.com') Your email address -- used in Atom/RSS feeds and as contact ability at the bottom in the default layout.
ENCODING ('utf-8') Default encoding of your text files, only global.
OUTPUT_IGNORE (['/style.css', '/images/*', '.git/']) A list of filename/directory-patterns which Acrylamid should ignore.
CONTENT_IGNORE (not set) (same as OUTPUT_IGNORE but for CONTENT_DIR)
FILTERS (["markdown+codehilite(css_class=highlight)", "hyphenate"]) Global list of filters.
VIEWS (see example conf.py) Dictionary of views set in conf.py.
WWW_ROOT ('http://localhost:8000') Your actual website link where you host this blog. It's used to build absolute urls (required for disqus and feeds).
CONTENT_DIR`(``content/`) Directory where you write your posts to.
LAYOUT_DIR (layouts/) Directory where you place your jinja2 templates.
OUTPUT_DIR (output/) Directory where the output goes to.
FILTERS_DIR (not set) If you want add your own filters, create a directory, put your filters into and add this directory to conf.
VIEWS_DIR (not set) Like above but for custom views.

Templating Engine

Variable name (default value) Description
ENGINE ('acrylamid.templates.jinja2.Environment') The full (importable) name of the Environment class (see acrylamid.templates.AbstractEnvironment) for your templating engine (currently, acrylamid supports jinja2 and Mako).

URL Settings

When it comes to URLs, Acrylamid follows two simple rules: always add a index.html to an URL with trailing slash. Secondly: substitution variables begin with a double dash and then the wished attribute:

  • /2012/hello-world/ gets a index.html as filename for nice URLs

  • /atom/index.html gets not touched anywhere and uses index.html as filename.

  • /page/:num/ gets expanded to /page/2/index.html if num = 2, see :doc:`views` for details.

    System Message: ERROR/3 (<string>, line 120); backlink

    Unknown interpreted text role "doc".

Use :doc:`views` and :doc:`templating` as reference guide for all possible variable name substitutions in a current view.

System Message: ERROR/3 (<string>, line 123); backlink

Unknown interpreted text role "doc".

System Message: ERROR/3 (<string>, line 123); backlink

Unknown interpreted text role "doc".
Variable name (default value) Description
ENTRY_PERMALINK (not set) A substitution string where all entries were saved to By default you don’t need to set this parameter because it takes the route where the view is entry But if your url routes for the entry view are ambiguous, set this parameter.
PAGE_PERMALINK (not set) Same for ENTRY_PERMALINK but for static pages and the static view.

Date format and locale

A few filters and views (namely hyphenation and syndication feeds) depend on a valid locale and language. By default we use the system's locale but in some cases you would rather use a different. Thus, you can set LANG to your favourite language (if available) and it will be also used as default language for hyphenation.

Variable name (default value) Description
LANG ('' [2]) Default language [3] to use -- is important for hyphenation patterns. Is available as two-character locale in templating.
DATE_FORMAT ('%d.%m.%Y, %H:%M') This python date-format string is used in layout/entry.html to render the date nicely. See Python's strftime directives for detailed explanation of these variables.
strptime ('%d.%m.%Y, %H:%M')

Format to parse the date: value using :func:`time.strptime`. The default matches 23.12.2012, 09:00, see python's reference strftime

System Message: ERROR/3 (<string>, line 160); backlink

Unknown interpreted text role "func".
[2] default is the system locale.
[3] see ISO_639, if not set or the given locale is not available, the system's will be used. If you don't like this behaviour, use 'C' instead which results in an english locale. On linux and you may not have generated all locales, try en-us instead of en or use the exact locale like "en_US.UTF-8".

Miscellaneous

Variable name (default value) Description
METASTYLE (not set) With native you can Acrylamid parse Markdown's native meta data section if the filename ends with .md or .mkdown.
DISQUS_SHORTNAME (not set) Enables Disqus integration with your site identifier [4].
DEFAULT_ORPHANS (0) The minimum number of articles allowed on the last page. Use this when you don’t want to have a last page with very few articles.
SUMMARIZE_MODE (1) Mode 0 this injects the link to the end of the current tag, 1 after some black-listed tags and 2 after all tags as standalone link.
SUMMARIZE_LINK ('<span>&#8230;<a href="%s" class="continue">continue</a>.</span>') Simple string template for the continue reading link. Default uses an ellipsis (three typographical dots, …), a link with the css class continue and the text continue and a single dot afterwards. This string must contain one %s where the link address will be inserted.
[4] Note, disqus only knows a given URL. If you change the title of an entry and you don't setup recirect codes or leave the original url by setting permalink: /2011/a-title/, you'll lose your disqus comments for this thread.

Tag cloud

If you want to generate a tag cloud with all your tags, you can do so using the following settings.

Variable name (default value) Description
TAG_CLOUD_STEPS (4) Count of different font sizes in the tag cloud.
TAG_CLOUD_MAX_ITEMS (100) Maximum number of tags in the cloud.
TAG_CLOUD_START_INDEX (0) Start index of font sizes in the tag cloud.
TAG_CLOUD_SHUFFLE (False) Shuffle tag list.

The default theme does not support tag clouds, but it is fairly easy to add:

<ul>
{% for tag in env.tag_cloud %}
    <li class="tag-{{ tag.step }}"><a href="/tag/{{ tag.name | safeslug }}/">{{ tag.name }}</a></li>
{% endfor %}
</ul>

You should then also define a CSS style with the appropriate classes (tag-0 to tag-N, where N matches TAG_CLOUD_STEPS -1).

Something went wrong with that request. Please try again.