jekyll/site/_posts/2016-10-03-jekyll-3-3-0-rel...

3.5 KiB

layout title date author version categories
news_item Jekyll 3.3 is here with better theme support, new URL filters, and tons more 2016-10-03 17:08:38 -0700 parkr 3.3.0
release

We have tons of new features for you in our latest release of Jekyll. Three key things you might want to give a whirl:

1. Themes can now ship static & dynamic assets in an /assets directory

We're really stoked about this one. In Jekyll 3.2, we shipped the ability to use a theme that was packaged as a gem. Due to security necessities and ease-of-use concerns, this initial ship only included support for includes, layouts, and sass partials. A theme couldn't write any CSS, JavaScript, or content to your site.

In an effort to make theme management a bit easier, any files you put into /assets in your theme will be read in as though they were part of the user's site. This means you can ship SCSS and CoffeeScript, images and webfonts, JSON and other data. Same rules apply here as in a Jekyll site: if it has YAML front matter, it will be converted and renderd. No YAML front matter, and it will simply be copied over like a static asset. Neat, huh?

See our documentation on the subject for more info.

2. relative_url and absolute_url filters

Want a clean way to prepend the baseurl or url in your config? These new filters have you covered. When working locally, if you set your baseurl to match your deployment environment, say baseurl: "/myproject", then relative_url will ensure that this baseurl is prepended to anything you pass it:

{% highlight liquid %} {% raw %} {{ "/docs/assets/" | relative_url }} => /myproject/docs/assets {% endraw %} {% endhighlight %}

A result of relative_url will safely always yield a link which is relative to the domain root. A similar principle applies to absolute_url. It prepends your baseurl and url values, making absolute URL's all the easier to make:

{% highlight liquid %} {% raw %} {{ "/docs/assets/" | absolute_url }} => http://jekyllrb.com/myproject/docs/assets {% endraw %} {% endhighlight %}

3. site.url is set by the development server

When you run jekyll serve locally, it starts a web server, usually at http://localhost:4000, that you use to preview your site during development. If you are using the new absolute_url filter, or using site.url anywhere, you have probably had to create a development config which resets the url value to point to http://localhost:4000.

No longer! When you run jekyll serve, Jekyll will build your site with the value of the host, port, and SSL-related options. This defaults to url: http://localhost:4000. When you are developing locally, site.url will yield http://localhost:4000.

Note that this only applies when JEKYLL_ENV is equal to development. If you set JEKYLL_ENV=production and run jekyll serve, it will not overwrite the value of url in your config. And again, this only applies to serving, not to building.

A lot more!

There are dozens of bug fixes and minor improvements to make your Jekyll experience better than ever. With every Jekyll release, we strive to bring greater stability and reliability to your everyday development workflow.

As always, thanks to our many contributors who contributed countless hours of their free time to making this release happen:

!! TODO: Add list of contributors for this release!

[Full release notes]({{ "/docs/history/" | relative_url }}) are available for your perusal. If you notice any issues, please don't hesitate to file a bug report.

Happy Jekylling!