diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f90514f60..f2f03c641 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,3 +97,36 @@ The site devhints.io is backed by CloudFlare. Updates will take 2 days to propag ```bash ./_support/cf-purge.sh ``` + +## SEO description + +There are multiple ways to set meta description. + +### keywords (and intro) + +Set `keywords` (and optionally `intro`). This is the easiest and the preferred +way for now. + +``` +React cheatsheet - devhints.io +------------------------------ +https://devhints.io/react ▼ +React.Component · render() · componentDidMount() · props/state · React is a +JavaScript library for building web... +``` + +### description (and intro) + +Set `description` (and optionally `intro`) + +``` +React cheatsheet - devhints.io +------------------------------ +https://devhints.io/react ▼ +One-page reference to React and its API. React is a JavaScript library for +building web user interfaces... +``` + +### intro only + +If you left out `description` or `keywords`, a default description will be added. diff --git a/_includes/values/description.html b/_includes/values/description.html index 297975fd5..267d7d7aa 100644 --- a/_includes/values/description.html +++ b/_includes/values/description.html @@ -2,7 +2,11 @@ if page.description and page.intro %}{{ page.description }} {{ page.intro | markdownify | strip_html }}{% elsif page.description -%}{{ page.description }}{% +%}{{ page.description }} · One-page guide to {{ page.title }}{% + elsif page.keywords and page.intro +%}{{ page.keywords | join: ' · ' }} · {{ page.intro | markdownify | strip_html }}{% + elsif page.keywords +%}{{ page.keywords | join: ' · ' }} · One-page guide to {{ page.title }}{% elsif page.intro %}One-page guide to {{ page.title }}: usage, examples, and more. {{ page.intro | markdownify | strip_html }}{% elsif page.type == 'article' diff --git a/css.md b/css.md index a928913ce..fc9969061 100644 --- a/css.md +++ b/css.md @@ -2,8 +2,14 @@ title: CSS category: CSS layout: 2017/sheet -tags: [WIP] weight: -1 +keywords: + - "margin, padding, border" + - "div, .class, #id, [attr]" + - "font, background" + - "display: block, inline, flex" + - Selectors + - Properties --- ## Basics diff --git a/enzyme.md b/enzyme.md index 4e105e548..6f5c70545 100644 --- a/enzyme.md +++ b/enzyme.md @@ -5,8 +5,12 @@ layout: 2017/sheet updated: 2017-10-12 tags: [Featured] weight: -1 -description: | - shallow() · mount() · wrap.setProps() · wrap.find().simulate('click') · wrap.contains(
) · +keywords: + - shallow() + - mount() + - wrap.setProps() + - "wrap.find().simulate('click')" + - "wrap.contains()" intro: | [Enzyme](http://airbnb.io/enzyme) lets you write unit tests for React components. This guide covers Enzyme 3.x. --- diff --git a/react.md b/react.md index e381ee545..c33c62f40 100644 --- a/react.md +++ b/react.md @@ -6,8 +6,12 @@ ads: true tags: [Featured] updated: 2017-10-10 weight: -10 -description: | - React.Component · render() · componentDidMount() · props/state · dangerouslySetInnerHTML · +keywords: + - React.Component + - render() + - componentDidMount() + - props/state + - dangerouslySetInnerHTML intro: | [React](https://reactjs.org/) is a JavaScript library for building user interfaces. This guide targets React v15 to v16. --- diff --git a/sass.md b/sass.md index 575805969..7f68aa962 100644 --- a/sass.md +++ b/sass.md @@ -5,8 +5,14 @@ layout: 2017/sheet tags: [Featured] updated: 2017-08-26 weight: -5 -description: | - Variables · mixins · darken() · adjust-color() · @for @each @while @if @else · $list: (a b c) · $map: (a: b, c: d) +keywords: + - Variables + - mixins + - darken() + - adjust-color() + - "@for @each @while @if @else" + - $list: (a b c) + - $map: (a: b, c: d) --- ## Basics