diff --git a/History.markdown b/History.markdown index cb6f447d..fdb618fa 100644 --- a/History.markdown +++ b/History.markdown @@ -20,13 +20,21 @@ * Fix typo in contribution information (#5910) * update plugin repo URL to reflect repo move (#5916) * Update exclude array in configuration.md (#5947) + * Fixed path in "Improve this page" link in Tutorials section (#5951) + * Corrected permalink (#5949) + * Included more details about adding defaults to static files (#5971) + * Create buddyworks (#5962) + * added (buddyworks) to ci list (#5965) + * Add a tutorial on serving custom Error 404 page (#5946) + * add custom 404 to tutorial navigation (#5978) ### Development Fixes * [Rubocop] add missing comma (#5835) * Appease classifier-reborn (#5934) - * Allow releases & development on *-stable branches (#5926) + * Allow releases & development on `*-stable` branches (#5926) * Add script/backport-pr (#5925) + * Prefer .yaml over .toml (#5966) ### Site Enhancements @@ -43,6 +51,11 @@ * Convertible#validate_permalink!: ensure the return value of data["permalink"] is a string before asking if it is empty (#5878) * Allow abbreviated post dates (#5920) * Remove dependency on include from default about.md (#5903) + * Allow colons in `uri_escape` filter (#5957) + +## 3.4.3 / 2017-03-21 + + * Backport #5957 for v3.4.x: Allow colons in `uri_escape` filter (#5968) ## 3.4.2 / 2017-03-09 diff --git a/docs/_data/tutorials.yml b/docs/_data/tutorials.yml index ad4f4e5c..809c7e55 100644 --- a/docs/_data/tutorials.yml +++ b/docs/_data/tutorials.yml @@ -3,6 +3,7 @@ - home - navigation - orderofinterpretation + - custom-404-page #- title: Another section # tutorials: diff --git a/docs/_docs/continuous-integration/buddyworks.md b/docs/_docs/continuous-integration/buddyworks.md new file mode 100644 index 00000000..1dea8be5 --- /dev/null +++ b/docs/_docs/continuous-integration/buddyworks.md @@ -0,0 +1,62 @@ +--- +title: "BuddyWorks" +--- + +[BuddyWorks][buddyworks-homepage] is a [Docker][docker-homepage]-based CI server that you can set up in 15-20 minutes to build, test, and deploy your Jekyll websites. It supports [GitHub][github-homepage], [Bitbucket][bitbucket-homepage], and [GitLab][gitlab-homepage] repositories, and can be installed on-premises or used in cloud. The following guide will show you how to set up a free environment to build and test your Jekyll project. + +[buddyworks-homepage]: https://buddy.works +[docker-homepage]: https://www.docker.com/ +[github-homepage]: https://github.com +[bitbucket-homepage]: https://bitbucket.org/ +[gitlab-homepage]: https://gitlab.com + +## 1. Getting started + +1. Log in at https://buddy.works with your GitHub/Bitbucket account or email +2. Choose your Git provider and select or push your Jekyll Project +3. Create a new pipeline and set the trigger mode to 'On every push' +4. Add and configure the Jekyll action and save the pipeline + +## 2. How it works + +Whenever you make a push to the selected branch, the Jekyll action runs `jekyll build` in an isolated [Jekyll Docker image][jekyll-docker-image]. The output is generated to the `/filesystem` directory, and can be further deployed to FTP/SFTP and IaaS services. You can add your own commands, install additional packages, attach services, and run Selenium tests, as well as add other actions down the pipeline, eg. a Slack notification or an SSH script that will restart your server. + +![Jekyll Build](https://buddy.works/data/blog/_images/buddyworks-jekyll-small.png) + +[jekyll-docker-image]: https://hub.docker.com/r/jekyll/jekyll/ + +## 3. Using YAML for configuration + +If you prefer configuration as code over GUI, you can generate a `buddy.yml` that will create a pipeline with the Jekyll action once you push it to the target branch: + +```ruby +- pipeline: "Build and Deploy Jekyll site" + trigger_mode: "ON_EVERY_PUSH" + ref_name: "master" + actions: + - action: "Execute: jekyll build" + type: "BUILD" + docker_image_name: "jekyll/jekyll" + docker_image_tag: "latest" + execute_commands: + - "chown jekyll:jekyll $WORKING_DIR" + - "jekyll build" +``` + +## 4. Setting up on-premises server + +The self-hosted version of BuddyWorks can be installed on any type of server supporting Docker, including [Linux][bw-linux], [Mac][bw-mac], [AWS EC2][bw-aws-ec2], [DigitalOcean][bw-digitalocean], and [Microsoft Azure][bw-azure]. + +[bw-linux]: https://buddy.works/knowledge/standalone/installation-linux +[bw-mac]: https://buddy.works/knowledge/standalone/installation-mac-osx +[bw-aws-ec2]: https://buddy.works/knowledge/standalone/installation-amazon-ec2 +[bw-digitalocean]: https://buddy.works/knowledge/standalone/installation-digitalocean +[bw-azure]: https://buddy.works/knowledge/standalone/installation-azure + +## 5. Questions? + +This entire guide is open-source. Go ahead and [edit it][jekyll-docs-ci-buddyworks] if you want to expand it or have a fix or [ask for help][jekyll-help] if you run into trouble and need assistance. BuddyWorks also has an [online community][buddyworks-forum] for help. + +[jekyll-docs-ci-buddyworks]: https://github.com/jekyll/jekyll/edit/master/docs/_docs/continuous-integration/buddyworks.md +[jekyll-help]: https://jekyllrb.com/help/ +[buddyworks-forum]: http://forum.buddy.works/ diff --git a/docs/_docs/continuous-integration/index.md b/docs/_docs/continuous-integration/index.md index 14c5c749..a9a12267 100644 --- a/docs/_docs/continuous-integration/index.md +++ b/docs/_docs/continuous-integration/index.md @@ -7,3 +7,4 @@ Continuous Integration (CI) enables you to publish your Jekyll generated website * [Travis CI](travis-ci) * [CircleCI](circleci) +* [BuddyWorks](buddyworks) diff --git a/docs/_docs/datafiles.md b/docs/_docs/datafiles.md index a389a658..671a3206 100644 --- a/docs/_docs/datafiles.md +++ b/docs/_docs/datafiles.md @@ -153,4 +153,4 @@ author: dave {% endraw %} ``` -For information on how to build robust navigation for your site (especially if you have a documentation website or another type of Jekyll site with a lot of pages to organize), see [Navigation](../navigation). +For information on how to build robust navigation for your site (especially if you have a documentation website or another type of Jekyll site with a lot of pages to organize), see [Navigation](/tutorials/navigation). diff --git a/docs/_docs/history.md b/docs/_docs/history.md index 3c821eda..d0938169 100644 --- a/docs/_docs/history.md +++ b/docs/_docs/history.md @@ -4,11 +4,16 @@ permalink: "/docs/history/" note: This file is autogenerated. Edit /History.markdown instead. --- +## 3.4.3 / 2017-03-21 +{: #v3-4-3} + +- Backport [#5957]({{ site.repository }}/issues/5957) for v3.4.x: Allow colons in `uri_escape` filter ([#5968]({{ site.repository }}/issues/5968)) + + ## 3.4.2 / 2017-03-09 {: #v3-4-2} -- Backport [#5871]({{ site.repository }}/issues/5871) for v3.4.x: Convert StaticFile liquid representation to - a Drop & add front matter defaults support to StaticFiles ([#5940]({{ site.repository }}/issues/5940)) +- Backport [#5871]({{ site.repository }}/issues/5871) for v3.4.x: Convert StaticFile liquid representation to a Drop & add front matter defaults support to StaticFiles ([#5940]({{ site.repository }}/issues/5940)) ## 3.4.1 / 2017-03-02 diff --git a/docs/_docs/static_files.md b/docs/_docs/static_files.md index 523c29df..a4dda588 100644 --- a/docs/_docs/static_files.md +++ b/docs/_docs/static_files.md @@ -65,3 +65,34 @@ following metadata: + +Note that in the above table, `file` can be anything. It's simply an arbitrarily set variable used in your own logic (such as in a for loop). It isn't a global site or page variable. + +## Add front matter to static files + +Although you can't directly add front matter values to static files, you can set front matter values through the [defaults property](../configuration/#front-matter-defaults) in your configuration file. When Jekyll builds the site, it will use the front matter values you set. + +Here's an example: + +In your `_config.yml` file, add the following values to the `defaults` property: + +```yaml +defaults: + - scope: + path: "assets/img" + values: + image: true +``` + +This assumes that your Jekyll site has a folder path of `assets/img` where you have images (static files) stored. When Jekyll builds the site, it will treat each image as if it had the front matter value of `image: true`. + +Suppose you want to list all your image assets as contained in `assets/img`. You could use this for loop to look in the `static_files` object and get all static files that have this front matter property: + +```liquid +{% raw %}{% assign image_files = site.static_files | where: "image", true %} +{% for myimage in image_files %} + {{ myimage.path }} +{% endfor %}{% endraw %} +``` + +When you build your site, the output will list the path to each file that meets this front matter condition. diff --git a/docs/_layouts/tutorials.html b/docs/_layouts/tutorials.html index e3f7794b..3850971c 100644 --- a/docs/_layouts/tutorials.html +++ b/docs/_layouts/tutorials.html @@ -10,7 +10,7 @@ layout: default

{{ page.title }}

diff --git a/docs/_posts/2017-03-21-jekyll-3-4-3-released.markdown b/docs/_posts/2017-03-21-jekyll-3-4-3-released.markdown new file mode 100644 index 00000000..a51fdf49 --- /dev/null +++ b/docs/_posts/2017-03-21-jekyll-3-4-3-released.markdown @@ -0,0 +1,49 @@ +--- +title: 'Jekyll 3.4.3 Released' +date: 2017-03-21 08:52:53 -0500 +author: pathawks +version: 3.4.3 +categories: [release] +--- + +Another one-PR patch update as we continue our quest to destroy all bugs. A +fairly technical debriefing follows, but the TLDR is that we have updated the +`uri_escape` filter to more closely follow the pre-v3.4.0 behavior. + +In [v3.4.0]({% link _posts/2017-01-18-jekyll-3-4-0-released.markdown %}), we +moved away from using the deprecated +[`URI.escape`](https://ruby-doc.org/stdlib-2.3.0/libdoc/uri/rdoc/URI/Escape.html#method-i-encode) +in favor of +[`Addressable::URI.encode`](http://www.rubydoc.info/gems/addressable/Addressable/URI#encode-class_method). +This is what powers our [`uri_escape` +filter](https://jekyllrb.com/docs/templates/). + +While this transition was mostly a smooth one, the two methods are not +identical. While `URI.escape` was happy to escape any string, +`Addressable::URI.encode` first turns the string into an `Addressable::URI` +object, and will then escape each component of that object. In most cases, this +difference was insignificant, but there were a few cases where this caused some +unintended regressions when encoding colons. + +While **Addressable** can understand that something like `"/example :page"` is a +relative URI, without the slash it cannot figure out how to turn +`"example :page"` into an `Addressable::URI` object. `URI.escape` had no such +objection. This lead to the following Liquid code working fine in Jekyll 3.3.x +but breaking in 3.4.0: + +{% raw %} +```liquid +{{ "example :page" | uri_escape }} +``` +{% endraw %} + +This was not an intended consequence of switching to **Addressable**. + +Fortunately, the solution was not complicated. **Addressable** has a method +[`Addressable::URI.normalize_component`](http://www.rubydoc.info/gems/addressable/Addressable/URI#normalize_component-class_method) +which will simply escape the characters in a string, much like `URI.escape`. + +Thanks to @cameronmcefee and @FriesFlorian for reporting +[this issue](https://github.com/jekyll/jekyll/issues/5954). + +Happy Jekylling! diff --git a/docs/_tutorials/custom-404-page.md b/docs/_tutorials/custom-404-page.md new file mode 100644 index 00000000..40bb3262 --- /dev/null +++ b/docs/_tutorials/custom-404-page.md @@ -0,0 +1,66 @@ +--- +layout: tutorials +permalink: /tutorials/custom-404-page/ +title: Custom 404 Page +--- + +You can easily serve custom 404 error pages with Jekyll to replace the default **Error 404 -- File Not Found** page displayed when one tries to access a broken link on your site. + + +## On GitHub Pages + +Any `404.html` at the **root of your `_site` directory** will be served automatically by GitHub Pages and the local WEBrick development server. + +Simply add a `404.md` or `404.html` at the root of your site's source directory and include the YAML Front Matter data to use the theme's base layout. + +If you plan to organize your files under subdirectories, the error page should have the following Front Matter Data, set: `permalink: /404.html`. This is to ensure that the compiled `404.html` resides at the root of your processed site, where it'll be picked by the server. + +``` +--- +# example 404.md + +layout: default +permalink: /404.html +--- + +# 404 + +Page not found! :( +``` + +## Hosting on Apache Web Servers + +Apache Web Servers load a configuration file named [`.htaccess`](http://www.htaccess-guide.com/) that modifies the functionality of these servers. + +Simply add the following to your `.htaccess` file. + +``` +ErrorDocument 404 /404.html +``` + +With an `.htaccess` file, you have the freedom to place your error page within a subdirectory. + +``` +ErrorDocument 404 /error_pages/404.html +``` + +Where the path is relative to your site's domain. + +More info on configuring Apache Error Pages can found in [official documentation](https://httpd.apache.org/docs/current/mod/core.html#errordocument). + + +## Hosting on Nginx server + +The procedure is just as simple as configuring Apache servers, but slightly different. + +Add the following to the ngnix configuration file, `nginx.conf`, which is usually located inside `/etc/nginx/` or `/etc/nginx/conf/`: + +``` +server { + error_page 404 /404.html; + location /404.html { + internal; + } +} +``` +The `location` directive prevents users from directly browsing the 404.html page. diff --git a/docs/latest_version.txt b/docs/latest_version.txt index 4d9d11cf..6cb9d3dd 100644 --- a/docs/latest_version.txt +++ b/docs/latest_version.txt @@ -1 +1 @@ -3.4.2 +3.4.3 diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index b4bf7c5a..1e2ca01c 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -137,7 +137,7 @@ module Jekyll SafeYAML.load_file(filename) || {} else raise ArgumentError, "No parser for '#{filename}' is available. - Use a .toml or .y(a)ml file instead." + Use a .y(a)ml or .toml file instead." end end diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 0393ea24..3020bfbc 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -152,7 +152,7 @@ module Jekyll # # Returns the escaped String. def uri_escape(input) - Addressable::URI.encode(input) + Addressable::URI.normalize_component(input) end # Replace any whitespace in the input string with a single space diff --git a/lib/jekyll/version.rb b/lib/jekyll/version.rb index fc43a4c3..1c4a0b96 100644 --- a/lib/jekyll/version.rb +++ b/lib/jekyll/version.rb @@ -1,3 +1,3 @@ module Jekyll - VERSION = "3.4.2".freeze + VERSION = "3.4.3".freeze end diff --git a/test/test_filters.rb b/test/test_filters.rb index d18b57e3..782b5be9 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -317,6 +317,11 @@ class TestFilters < JekyllUnitTest assert_equal "my%20things", @filter.uri_escape("my things") end + should "allow colons in URI" do + assert_equal "foo:bar", @filter.uri_escape("foo:bar") + assert_equal "foo%20bar:baz", @filter.uri_escape("foo bar:baz") + end + context "absolute_url filter" do should "produce an absolute URL from a page URL" do page_url = "/about/my_favorite_page/"