Skip to content

Commit

Permalink
Use a collection instead of pages for the articles
Browse files Browse the repository at this point in the history
  • Loading branch information
Katrina Owen committed Sep 10, 2016
1 parent 7162588 commit 3cd100c
Show file tree
Hide file tree
Showing 28 changed files with 57 additions and 43 deletions.
12 changes: 6 additions & 6 deletions getting-started/index.md → _articles/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: How to start an open source project
nav: Getting started
next: getting-started/defining.md
following: _articles/getting-started/defining.md
contents:
- getting-started/defining.md
- getting-started/setting-expectations.md
- getting-started/branding.md
- getting-started/preparing.md
- getting-started/legal.md
- _articles/getting-started/defining.md
- _articles/getting-started/setting-expectations.md
- _articles/getting-started/branding.md
- _articles/getting-started/preparing.md
- _articles/getting-started/legal.md
---

First things first: we're here to help you launch projects of all shapes and sizes, but you may find certain sections more or less useful, depending on what you need.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Branding your open source project
nav: Branding
next: getting-started/preparing.md
following: _articles/getting-started/preparing.md
---

Wondering what to name your project? Let's talk about your project's brand.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: What is an open source project?
nav: What it means to open source
next: getting-started/setting-expectations.md
following: _articles/getting-started/setting-expectations.md
---

So you're interested in making your project open source? Congratulations! 🎉 The world appreciates your contribution.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Launching your open source project
nav: Preparing for launch
next: marketing/index.md
following: _articles/marketing.md
---

You've written down your goals, you've chosen a name and an idea, and hopefully you've been hard at work building your project. (Haven't started yet? [Create a repository!](https://help.github.com/articles/create-a-repo/))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Setting expectations for your open source project
nav: Setting expectations
next: getting-started/branding.md
following: _articles/getting-started/branding.md
---

There are many reasons to open source a project. It's a good idea to figure out yours before going public with your project. What you want to get out of the experience will guide how you manage your project and help you figure out where to say yes (and no!).
Expand Down
8 changes: 4 additions & 4 deletions marketing/index.md → _articles/marketing.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Marketing your open source project
nav: Marketing your project
next: marketing/spreading-word.md
following: _articles/marketing/spreading-word.md
contents:
- marketing/spreading-word.md
- marketing/building-community.md
- marketing/measuring.md
- _articles/marketing/spreading-word.md
- _articles/marketing/building-community.md
- _articles/marketing/measuring.md
---

This section of the handbook will help you spread the word about your project and grow your initial community of users and contributors. If you're looking for feedback on your project, or want people to use and share your work, this part is for you.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Building an open source community
nav: Building a community
next: marketing/measuring.md
following: _articles/marketing/measuring.md
---

You've launched your project, you're spreading the word, and people are checking out your project. Awesome! Now, how do you get them to stick around? In this section, we'll discuss ways to encourage people to use, contribute to, and evangelize your project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Measuring the success of your open source project
nav: Measuring success
next: sustaining/index.md
following: _articles/sustaining.md
---

Your project is starting to grow. 🌱 Well, you think it's growing. Is it growing? Let's talk about how to measure and track the success of your open source project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Promoting your open source project
nav: Spreading the word
next: marketing/building-community.md
following: _articles/marketing/building-community.md
---

You've just published your project–what's next? It's time to tell everybody about your hard work!
Expand Down
8 changes: 4 additions & 4 deletions sustaining/index.md → _articles/sustaining.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Sustaining growth of your open source project
nav: Sustaining growth
next: sustaining/best-practices.md
following: _articles/sustaining/best-practices.md
contents:
- sustaining/best-practices.md
- sustaining/healthy-communities.md
- sustaining/leadership.md
- _articles/sustaining/best-practices.md
- _articles/sustaining/healthy-communities.md
- _articles/sustaining/leadership.md
---

Congratulations! You launched a project into the universe, and it managed to hit escape velocity. People are using your project, contributing back, and telling their friends. Your project has a bright future ahead of it. 👏 🚀 🌠
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Best practices for open source project maintenance
nav: Best practices for maintainers
next: sustaining/healthy-communities.md
following: _articles/sustaining/healthy-communities.md
---

We spend plenty of time talking about how to make other people happy. But first and foremost, make yourself happy. Maintainer happiness is a non-negotiable requirement for the survival of any open source project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Sustaining healthy open source communities
nav: Sustaining healthy communities
next: sustaining/leadership.md
following: _articles/sustaining/leadership.md
---

Your project's community is extremely powerful. That power can be a blessing or a curse, depending on how you wield it. In this section, we'll look at ways to structure your community to become a force of construction, not destruction.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Open source project leadership & governance
nav: Leadership & governance
next: troubleshooting/index.md
following: _articles/troubleshooting.md
---

Your project is growing, people are engaged, and you're committed to keeping this thing going. At this stage, you're probably starting to wonder about governance.
Expand Down
10 changes: 5 additions & 5 deletions troubleshooting/index.md → _articles/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Open source project troubleshooting & maintenance
nav: Troubleshooting
contents:
- troubleshooting/conduct.md
- troubleshooting/burnout.md
- troubleshooting/finding-consensus.md
- troubleshooting/contributions.md
- troubleshooting/getting-paid.md
- _articles/troubleshooting/conduct.md
- _articles/troubleshooting/burnout.md
- _articles/troubleshooting/finding-consensus.md
- _articles/troubleshooting/contributions.md
- _articles/troubleshooting/getting-paid.md
---

This section of the handbook addresses some common situations that may come up as you maintain your open source project.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ exclude:

permalink: /:path/

collections:
articles:
output: true
permalink: /:path/

defaults:
- scope:
path: ""
Expand Down
2 changes: 1 addition & 1 deletion _data/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title:
contents:
type: Array

next:
following:
type: String

nav:
Expand Down
2 changes: 1 addition & 1 deletion _includes/contents.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ul class="list-unstyled">
{% for path in item.contents %}
{% assign subpage = site.pages | where: "path", path | first %}
{% assign subpage = site.articles | where: "path", path | first %}
<li{% if page.url contains subpage.url %} class="selected"{% endif %}>
<a class="d-block {% if page.url == subpage.url %} current{% endif %}"
href="{{ subpage.url | prepend: site.baseurl }}">{% if subpage.nav == nil %}{{ subpage.title }}{% else %}{{ subpage.nav }}{% endif %}</a>
Expand Down
6 changes: 3 additions & 3 deletions _layouts/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1 class="mb-3 mb-lg-4 pt-md-3 pt-lg-8">{{ page.title }}</h1>
</div>
</div>

{% assign previous = site.pages | where: "next", page.path | first %}
{% assign previous = site.articles | where: "following", page.path | first %}
<div class="clearfix py-3 py-md-6">
<div class="col-md-6 mb-3">
{% if previous == null %}
Expand All @@ -45,8 +45,8 @@ <h1 class="mb-3 mb-lg-4 pt-md-3 pt-lg-8">{{ page.title }}</h1>
{% endif %}
</div>
<div class="col-md-6 text-md-right">
{% if page.next %}
{% assign next = site.pages | where: "path", page.next | first %}
{% if page.following %}
{% assign next = site.articles | where: "path", page.following | first %}
<p class="mb-1">Next</p>
<a href="{{ next.url | prepend: site.baseurl }}" class="text-gamma">{{ next.title }}</a>
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions contents.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
layout: default
contents:
- getting-started/index.md
- marketing/index.md
- sustaining/index.md
- troubleshooting/index.md
- _articles/getting-started.md
- _articles/marketing.md
- _articles/sustaining.md
- _articles/troubleshooting.md
---

{% include contents.html %}
5 changes: 5 additions & 0 deletions test/_config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Override config for tests
baseurl: ""

collections:
articles:
output: true
permalink: /:path/
6 changes: 5 additions & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ def config
Helper.config ||= Jekyll.configuration("source" => source)
end

def docs
(site.pages + site.collections["articles"].docs)
end

def pages
site.pages.map { |doc| doc.to_liquid }
docs.map { |doc| doc.to_liquid }
end

def site
Expand Down
8 changes: 4 additions & 4 deletions test/lint_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
end if attrs["type"]
end

it "`next` points to a page that exists" do
assert pages.detect {|p| p["path"] == page["next"] },
"Could not find page with path #{page["next"]}"
end if page["next"]
it "`following` points to a page that exists" do
assert pages.detect {|p| p["path"] == page["following"] },
"Could not find page with path #{page["following"]}"
end if page["following"]
end
end
end
Expand Down

0 comments on commit 3cd100c

Please sign in to comment.