Skip to content

[WIP] Add better SEO support#125

Closed
lee-dohm wants to merge 1 commit intogh-pagesfrom
bug-122
Closed

[WIP] Add better SEO support#125
lee-dohm wants to merge 1 commit intogh-pagesfrom
bug-122

Conversation

@lee-dohm
Copy link
Contributor

@lee-dohm lee-dohm commented Sep 9, 2016

Applies to #122

It appears the page excerpt part is going to be problematic. Jekyll extracts an excerpt automatically and this is what the jekyll-seo-tag gem relies on. The problem seems to be that Jekyll only extracts that excerpt on blog posts. Since all of the content in this site are normal pages, it isn't constructing the excerpt.

@lee-dohm lee-dohm changed the title Add better SEO support [WIP] Add better SEO support Sep 9, 2016
@bkeepers
Copy link

bkeepers commented Sep 9, 2016

It appears the page excerpt part is going to be problematic. Jekyll extracts an excerpt automatically and this is what the jekyll-seo-tag gem relies on. The problem seems to be that Jekyll only extracts that excerpt on blog posts. Since all of the content in this site are normal pages, it isn't constructing the excerpt.

I actually ran into this on #27 as well. I'd love to avoid manually setting an excerpt for each page, but we may need to.

@benbalter @parkr if you have time, I'd love your thoughts on the best way to handle this.

@parkr
Copy link

parkr commented Sep 9, 2016

@bkeepers Can we use collection documents instead of pages here? Collection documents give you automatic excerpts (same code as blog posts).

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

@parkr if you could point me to some docs about collection documents I can make the change (sorry, first time Jekyll user).

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

@parkr it looks like it's this: https://jekyllrb.com/docs/collections/#using-collections
I'll give it a whirl.

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

@bkeepers @parkr I have no idea what I'm looking at here. Unless someone has time to give me a pointer I'm going to pass on it.

@@ -1,4 +1,6 @@
title: "Open Source Handbook"
url: http://opensource.guide
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't do this, it should use site.github.url, which could account for things like HTTPS (in the works for GitHub-owned domains).

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

I've started on a conversion to collections here: https://github.com/github/open-source-handbook/tree/kytrinyx-collections

The basic site structure appears to be ok, but I haven't figured out the navigation yet.

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

Oh, and I bet the linting etc doesn't work with it yet.

@parkr
Copy link

parkr commented Sep 9, 2016

@kytrinyx We could pair on it if you want! Each folder just prefixes with an underscore (docs becomes _docs). It would still output to /docs in the resulting site and you get access to it in Liquid as site.docs. Same with marketing (_marketing and site.marketing), and so forth. 😄
For each of these, you would specify them in the config file so Jekyll knows about them:

collections:
- docs
- marketing

If you want to change the permalink, you can specify metadata:

collections:
  docs:
    output: true
    permalink: /lol/:title
  marketing:
    output: true

:)

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

@parkr Yes! I'd love to pair on it.

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

(I tried that approach and got a bunch of 404s, btw)

@kytrinyx
Copy link
Contributor

kytrinyx commented Sep 9, 2016

Here's what I have working:

# config
collections:
  articles:
    output: true
    permalink: /:path/
$ tree _articles
_articles/
├── getting-started
│   ├── branding.md
│   ├── defining.md
│   ├── legal.md
│   ├── preparing.md
│   └── setting-expectations.md
├── getting-started.md
├── marketing
│   ├── building-community.md
│   ├── measuring.md
│   └── spreading-word.md
├── marketing.md
├── sustaining
│   ├── best-practices.md
│   ├── healthy-communities.md
│   └── leadership.md
├── sustaining.md
├── troubleshooting
│   ├── burnout.md
│   ├── conduct.md
│   ├── contributions.md
│   ├── finding-consensus.md
│   └── getting-paid.md
└── troubleshooting.md

For the linter:

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

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

I have no idea how to translate the navigation:

<ul class="list-unstyled">
{% for path in item.contents %}
  {% assign subpage = site.pages | 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 }}">{{ subpage.title }}</a>
    {% if subpage.contents %}
      {% include contents.html item=subpage %}
    {% endif %}
  </li>
{% endfor %}
</ul>

I can't just swap out site.pages with site.articles.docs in this.

@kytrinyx
Copy link
Contributor

OK, I think I got this working. Thanks @benbalter and @parkr for patient handholding. PR in #132.

@nayafia
Copy link
Contributor

nayafia commented Sep 10, 2016

Closing this one. The most important thing we needed were meta descriptions, which was addressed in #132. Everything else was nice-to-haves/maybe-not-even-necessarys :)

Thanks everyone for your help!

@nayafia nayafia closed this Sep 10, 2016
@nayafia nayafia deleted the bug-122 branch September 10, 2016 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants