diff --git a/docs/.gitignore b/docs/.gitignore index 79bd74f74..527980f3c 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -2,3 +2,4 @@ _site/ *.swp pkg/ test/ +.idea/ \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml index 6f57710aa..589b042e2 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -16,6 +16,8 @@ collections: posts: permalink: /news/:year/:month/:day/:title/ output: true + tutorials: + output: true name: Jekyll • Simple, blog-aware, static sites description: Transform your plain text into static websites and blogs diff --git a/docs/_data/tutorials.yml b/docs/_data/tutorials.yml new file mode 100644 index 000000000..73a0184a1 --- /dev/null +++ b/docs/_data/tutorials.yml @@ -0,0 +1,8 @@ +- title: Tutorials + tutorials: + - home + - navigation + +#- title: Another section +# tutorials: +# - sample \ No newline at end of file diff --git a/docs/_includes/primary-nav-items.html b/docs/_includes/primary-nav-items.html index f3778a843..a431d846d 100644 --- a/docs/_includes/primary-nav-items.html +++ b/docs/_includes/primary-nav-items.html @@ -5,6 +5,9 @@
  • Docs
  • +
  • + Tutorials +
  • News
  • @@ -15,6 +18,6 @@ Help
  • - View on GitHub + GitHub
  • diff --git a/docs/_includes/section_nav_tutorials.html b/docs/_includes/section_nav_tutorials.html new file mode 100644 index 000000000..30812bbaf --- /dev/null +++ b/docs/_includes/section_nav_tutorials.html @@ -0,0 +1,39 @@ +{% comment %} +Map grabs the tutorials sections, giving us an array of arrays. Join, flattens all +the items to a comma delimited string. Split turns it into an array again. +{% endcomment %} +{% assign tutorials = site.data.tutorials | map: 'tutorials' | join: ',' | split: ',' %} + +{% comment %} +Because this is built for every page, lets find where we are in the ordered +document list by comparing url strings. Then if there's something previous or +next, lets build a link to it. +{% endcomment %} + +{% for tutorial in tutorials %} + {% assign tutorial_url = tutorial | prepend:"/tutorials/" | append:"/" %} + {% if tutorial_url == page.url %} +
    +
    + {% if forloop.first %} + Back + {% else %} + {% assign previous = forloop.index0 | minus: 1 %} + {% assign previous_page = tutorials[previous] | prepend:"/tutorials/" | append:"/" %} + + {% endif %} +
    +
    + {% if forloop.last %} + Next + {% else %} + {% assign next = forloop.index0 | plus: 1 %} + {% assign next_page = tutorials[next] | prepend:"/tutorials/" | append:"/" %} + + {% endif %} +
    +
    +
    + {% break %} + {% endif %} +{% endfor %} \ No newline at end of file diff --git a/docs/_includes/tutorials_contents.html b/docs/_includes/tutorials_contents.html new file mode 100644 index 000000000..5c9cdc8ee --- /dev/null +++ b/docs/_includes/tutorials_contents.html @@ -0,0 +1,10 @@ +
    + +
    diff --git a/docs/_includes/tutorials_contents_mobile.html b/docs/_includes/tutorials_contents_mobile.html new file mode 100644 index 000000000..901fdf5c4 --- /dev/null +++ b/docs/_includes/tutorials_contents_mobile.html @@ -0,0 +1,10 @@ +
    + +
    diff --git a/docs/_includes/tutorials_option.html b/docs/_includes/tutorials_option.html new file mode 100644 index 000000000..482c21433 --- /dev/null +++ b/docs/_includes/tutorials_option.html @@ -0,0 +1,5 @@ +{% for item in include.items %} + {% assign item_url = item | prepend:"/tutorials/" | append:"/" %} + {% assign tutorial = site.tutorials | where: "url", item_url | first %} + +{% endfor %} diff --git a/docs/_includes/tutorials_ul.html b/docs/_includes/tutorials_ul.html new file mode 100644 index 000000000..6604915c7 --- /dev/null +++ b/docs/_includes/tutorials_ul.html @@ -0,0 +1,7 @@ + diff --git a/docs/_layouts/tutorials.html b/docs/_layouts/tutorials.html new file mode 100644 index 000000000..e3f7794bd --- /dev/null +++ b/docs/_layouts/tutorials.html @@ -0,0 +1,27 @@ +--- +layout: default +--- + +
    +
    + + {% include tutorials_contents_mobile.html %} + +
    +
    + +

    {{ page.title }}

    + {{ content }} + {% include section_nav_tutorials.html %} +
    +
    + + {% include tutorials_contents.html %} + +
    + +
    +
    diff --git a/docs/_tutorials/index.md b/docs/_tutorials/index.md new file mode 100644 index 000000000..b0988b09f --- /dev/null +++ b/docs/_tutorials/index.md @@ -0,0 +1,35 @@ +--- +layout: tutorials +title: Tutorials +permalink: /tutorials/home/ +redirect_from: /tutorials/index.html +--- + +In contrast to [Docs](../docs), Tutorials provide more detailed, narrative instruction that cover a variety of Jekyll topics and scenarios. Tutorials might contain the following: + +* Step-by-step processes through particular scenarios or challenges +* Full walk-throughs using sample data, showing inputs and results from the sample data +* Detailed explanation about the pros and cons for different Jekyll strategies +* End-to-end instruction in developing a complete feature on a Jekyll site +* Instruction that combines various techniques from across the docs + +In short, tutorials aren't the core reference information in docs. They walk users through processes from beginning to end. + +{: .info .note} +**Note:** The Tutorials section is new, so there aren't many tutorials yet. You can add a tutorial here to help popular this section. + +Some of these techniques might even guide you through a supporting tool, script, service, or other hack used with your Jekyll site. Feel free to include tutorials involving external services with Jekyll as well. However, note that Jekyll in no way endorses any third-party tools mentioned in tutorials. + +## How to contribute a tutorial + +We welcome your tutorial contributions. To add your tutorial: + +1. Fork the Jekyll project by clicking the **Fork** button in the upper-right corner of the [jekyll/jekyll project Github repo](https://github.com/jekyll/jekyll/). +2. Add your tutorial in the `_tutorials` collection. +3. Make sure your tutorial has the same front matter items as other tutorial items. +5. Add a reference to your tutorial filename in `_data/tutorials.yml`. This allows your tutorial to appear in the Tutorials sidebar. +6. Follow the regular git workflow to submit the pull request. + +When you submit your pull request, the Jekyll documentation team will review your contribution and either merge it or suggest edits. + + diff --git a/docs/_tutorials/navigation.md b/docs/_tutorials/navigation.md index bd4228e37..60e86369a 100644 --- a/docs/_tutorials/navigation.md +++ b/docs/_tutorials/navigation.md @@ -1,6 +1,7 @@ --- -layout: docs -permalink: /docs/navigation +layout: tutorials +permalink: /tutorials/navigation/ +title: Navigation --- If your Jekyll site has a lot of pages, you might want to create navigation for the pages. Instead of hard-coding navigation links, you can programmatically retrieve a list of pages to build the navigation for your site.