Configuration

Customize Swifty to your liking.

Swifty believes in sensible defaults, but when you want to tweak things, the config file is your friend. Create a config.yaml (or config.yml or config.json if that's your jam) in your project root.

The Full Config Menu

Here's everything you can configure, with the defaults shown:

sitename: Swifty
author: Taylor Swift
site_url: https://yoursite.com
breadcrumb_separator: "»"
breadcrumb_class: swifty_breadcrumb
link_class: swifty_link
tag_class: tag
prev_next_class: swifty_link
default_layout_name: default
default_link_name: links
max_image_width: 800
image_quality: 80
responsive_image_widths: [320, 640, 800]
responsive_image_sizes: 100vw
default_og_image: /images/share.png
minify: true
minify_html: true
minify_css: true
minify_js: true
morphing: true
prefetching: true
morph_target: main

# Pagination
page_count: 10
pagination_class: swifty_pagination
pagination_link_class: swifty_pagination_link
pagination_current_class: swifty_pagination_current

# Sorting
date_sort_order: desc

dateFormat:
  weekday: short
  month: short
  day: numeric
  year: numeric

What Does What?

OptionWhat it does
sitenameYour site's name - use <%= sitename %> anywhere to display it
authorYour name (or whoever's taking credit)
site_urlFull URL of your site (required for RSS feeds and Open Graph tags)
breadcrumb_separatorThe character between breadcrumb links
breadcrumb_classCSS class for breadcrumb links
link_classCSS class for auto-generated links
tag_classCSS class for tag links
prev_next_classCSS class for previous/next page links
default_layout_nameThe fallback layout when no other applies
default_link_nameThe partial used for generating link lists
max_image_widthMaximum width for optimized images (in pixels)
image_qualityWebP quality for optimized images
responsive_image_widthsWidths Swifty generates for responsive image srcset candidates
responsive_image_sizesDefault sizes attribute added to responsive local images
default_og_imageFallback social sharing image when a page has no image or og_image
minifyEnable or disable all output minification
minify_htmlEnable or disable HTML minification
minify_cssEnable or disable CSS minification
minify_jsEnable or disable JavaScript whitespace minification
morphingEnable Idiomorph-powered same-origin page transitions
prefetchingPrefetch likely pages on hover, focus, or touch intent
morph_targetCSS selector for the element Swifty morphs between pages
page_countNumber of items per page before pagination kicks in
pagination_classCSS class for the pagination container
pagination_link_classCSS class for pagination links
pagination_current_classCSS class for the current page indicator
date_sort_orderSort order for pages by date: "desc" (newest first) or "asc"
dateFormatHow dates are formatted throughout your site

Using Config Values in Pages

Any config value can be dropped into your pages or layouts using ERB-style syntax:

Welcome to <%= sitename %>!
Written by <%= author %>.

Simple as that.

Morph Navigation

By default, Swifty fetches same-origin HTML links and morphs the configured page target with Idiomorph. It keeps the outer layout in place while updating the URL, title, focus, and scroll position.

morphing: true
prefetching: true
morph_target: main

Set prefetching: false if you want morphing without hover/focus/touch prefetches. Set morphing: false to return to plain browser navigation.

turbo is deprecated in Swifty 3. Use morphing and prefetching instead.

Folder-Level Config

Here's a neat trick: you can add a config.yaml inside any folder in pages/ to set defaults for all pages in that folder. Great for giving a whole section its own author or layout without repeating yourself.

RSS Feeds

Want to offer RSS feeds for your blog or news section? Easy. Just add the folders you want feeds for:

site_url: https://yoursite.com
rss_feeds:
  - blog
  - news

This generates /blog/rss.xml and /news/rss.xml automatically, including all pages within those folders.

Custom Feed Options

Need more control? Use the expanded format:

rss_feeds:
  - folder: blog
    title: My Awesome Blog
    description: Thoughts on code, coffee, and chaos
  - folder: news
    title: Company Updates
    description: The latest from our team

RSS Config Options

OptionWhat it does
site_urlRequired for RSS. The full URL of your site (used for absolute links in feeds)
rss_feedsList of folders to generate feeds for
rss_max_itemsMaximum items per feed (default: 20)
languageFeed language code (default: "en")

Each feed includes the page title, URL, publication date, and a description snippet. Feeds are sorted by date with the newest items first.