Skip to content

Commit

Permalink
Ensure bookmarks and shared URLs have reasonable tag lines
Browse files Browse the repository at this point in the history
  • Loading branch information
yanokwa committed May 30, 2018
1 parent c5c025a commit bc185e7
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 3 deletions.
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ locale : "en-US"
title : "Open Data Kit"
title_separator : "-"
name : &name "ODK Community" # &name is a YAML anchor which can be *referenced later
description : &description "Home of Open Data Kit"
description : &description "The Open Data Kit community produces free and open-source software for collecting, managing, and using data in resource-constrained environments."
tagline : The standard for mobile data collection
url : "http://staging.opendatakit.org" # the base hostname & protocol for your site e.g. "https://mmistakes.github.io"
baseurl : # the subpath of your site, e.g. "/blog"
repository : "opendatakit/website"
Expand Down
61 changes: 61 additions & 0 deletions _includes/page__hero.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{% if page.header.image contains "://" %}
{% capture img_path %}{{ page.header.image }}{% endcapture %}
{% else %}
{% capture img_path %}{{ page.header.image | relative_url }}{% endcapture %}
{% endif %}

{% if page.header.cta_url contains "://" %}
{% capture cta_path %}{{ page.header.cta_url }}{% endcapture %}
{% else %}
{% capture cta_path %}{{ page.header.cta_url | relative_url }}{% endcapture %}
{% endif %}

{% if page.header.overlay_image contains "://" %}
{% capture overlay_img_path %}{{ page.header.overlay_image }}{% endcapture %}
{% elsif page.header.overlay_image %}
{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %}
{% endif %}

{% if page.header.overlay_filter contains "rgba" %}
{% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %}
{% elsif page.header.overlay_filter %}
{% capture overlay_filter %}rgba(0, 0, 0, {{ page.header.overlay_filter }}){% endcapture %}
{% endif %}

{% if page.header.image_description %}
{% assign image_description = page.header.image_description %}
{% else %}
{% assign image_description = page.title %}
{% endif %}

{% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %}

<div class="page__hero{% if page.header.overlay_color or page.header.overlay_image %}--overlay{% endif %}"
style="{% if page.header.overlay_color %}background-color: {{ page.header.overlay_color | default: 'transparent' }};{% endif %} {% if overlay_img_path %}background-image: {% if overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}), {% endif %}url('{{ overlay_img_path }}');{% endif %}"
>
{% if page.header.overlay_color or page.header.overlay_image %}
<div class="wrapper">
<h1 id="page-title" class="page__title" itemprop="headline">
{% if paginator and site.paginate_show_page_num %}
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
{% else %}
{{ site.tagline | default: site.tagline | markdownify | remove: "<p>" | remove: "</p>" }}
{% endif %}
</h1>
{% if page.header.show_overlay_excerpt != false and page.excerpt %}
<p class="page__lead">{{ page.excerpt | markdownify | remove: "<p>" | remove: "</p>" }}</p>
{% endif %}
{% if site.read_time and page.read_time %}
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
{% endif %}
{% if page.header.cta_url %}
<p><a href="{{ cta_path }}" class="btn btn--light-outline btn--large">{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
{% endif %}
</div>
{% else %}
<img src="{{ img_path }}" alt="{{ image_description }}" class="page__hero-image">
{% endif %}
{% if page.header.caption %}
<span class="page__hero-caption">{{ page.header.caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
{% endif %}
</div>
166 changes: 166 additions & 0 deletions _includes/seo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<!-- begin _includes/seo.html -->
{%- if site.url -%}
{%- assign seo_url = site.url | append: site.baseurl -%}
{%- endif -%}
{%- assign seo_url = seo_url | default: site.github.url -%}

{% if site.title_separator %}
{% assign title_separator = site.title_separator | default: '-' | replace: '|', '&#124;' %}
{% endif %}

{%- if page.title -%}
{%- assign seo_title = site.title | append: " " | append: title_separator | append: " " | append: page.title -%}
{%- endif -%}

{%- if seo_title -%}
{%- assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once -%}
{%- endif -%}

{%- assign canonical_url = page.url | replace: "index.html", "" | absolute_url %}

{%- assign seo_description = page.description | default: page.excerpt | default: site.description -%}
{%- if seo_description -%}
{%- assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once -%}
{%- endif -%}

{%- assign author = page.author | default: page.authors[0] | default: site:author -%}
{%- assign author = site.data.authors[author] | default: author -%}

{%- if author.twitter -%}
{%- assign author_twitter = author.twitter | replace: "@", "" -%}
{%- endif -%}

{%- assign page_large_image = page.header.og_image | default: page.header.overlay_image | default: page.header.image -%}
{%- unless page_large_image contains '://' -%}
{%- assign page_large_image = page_large_image | absolute_url -%}
{%- endunless -%}
{%- assign page_large_image = page_large_image | escape -%}

{%- assign page_teaser_image = page.header.teaser | default: site.og_image -%}
{%- unless page_teaser_image contains '://' -%}
{%- assign page_teaser_image = page_teaser_image | absolute_url -%}
{%- endunless -%}
{%- assign page_teaser_image = page_teaser_image | escape -%}

{%- assign site_og_image = site.og_image -%}
{%- unless site_og_image contains '://' -%}
{%- assign site_og_image = site_og_image | absolute_url -%}
{%- endunless -%}
{%- assign site_og_image = site_og_image | escape -%}

{%- if page.date -%}
{%- assign og_type = "article" -%}
{%- else -%}
{%- assign og_type = "website" -%}
{%- endif -%}

<title>{{ seo_title | default: site.title }}</title>
<meta name="description" content="{{ seo_description }}">

{% if author.name %}
<meta name="author" content="{{ author.name | default: author }}">
{% endif %}

<meta property="og:type" content="{{ og_type }}">
<meta property="og:locale" content="{{ site.locale | replace: "-", "_" | default: "en_US" }}">
<meta property="og:site_name" content="{{ site.title }}">
<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
<meta property="og:url" content="{{ canonical_url }}">

{% if page.excerpt %}
<meta property="og:description" content="{{ seo_description }}">
{% endif %}

{% if page_large_image %}
<meta property="og:image" content="{{ page_large_image }}">
{% elsif page_teaser_image %}
<meta property="og:image" content="{{ page_teaser_image }}">
{% endif %}

{% if site.twitter.username %}
<meta name="twitter:site" content="@{{ site.twitter.username | replace: "@", "" }}">
<meta name="twitter:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
<meta name="twitter:description" content="{{ seo_description }}">
<meta name="twitter:url" content="{{ canonical_url }}">

{% if page_large_image %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ page_large_image }}">
{% else %}
<meta name="twitter:card" content="summary">
{% if page_teaser_image %}
<meta name="twitter:image" content="{{ page_teaser_image }}">
{% endif %}
{% endif %}

{% if author_twitter %}
<meta name="twitter:creator" content="@{{ author_twitter }}">
{% endif %}
{% endif %}

{% if page.date %}
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
{% endif %}

{% if og_type == "article" and page.last_modified_at %}
<meta property="article:modified_time" content="{{ page.last_modified_at | date_to_xmlschema }}">
{% endif %}

{% if site.facebook %}
{% if site.facebook.publisher %}
<meta property="article:publisher" content="{{ site.facebook.publisher }}">
{% endif %}

{% if site.facebook.app_id %}
<meta property="fb:app_id" content="{{ site.facebook.app_id }}">
{% endif %}
{% endif %}

<link rel="canonical" href="{{ canonical_url }}">

{% if paginator.previous_page %}
<link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}">
{% endif %}
{% if paginator.next_page %}
<link rel="next" href="{{ paginator.next_page_path | absolute_url }}">
{% endif %}

{% if site.og_image %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"url": {{ seo_url | jsonify }},
"logo": {{ site_og_image | jsonify }}
}
</script>
{% endif %}

{% if site.social %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "{% if site.social.type %}{{ site.social.type }}{% else %}Person{% endif %}",
"name": {{ site.social.name | default: site.name | jsonify }},
"url": {{ seo_url | jsonify }},
"sameAs": {{ site.social.links | jsonify }}
}
</script>
{% endif %}

{% if site.google_site_verification %}
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
{% endif %}
{% if site.bing_site_verification %}
<meta name="msvalidate.01" content="{{ site.bing_site_verification }}">
{% endif %}
{% if site.alexa_site_verification %}
<meta name="alexaVerifyID" content="{{ site.alexa_site_verification }}">
{% endif %}
{% if site.yandex_site_verification %}
<meta name="yandex-verification" content="{{ site.yandex_site_verification }}">
{% endif %}
{% if site.naver-site-verification %}
<meta name="naver-site-verification" content="{{ site.naver-site-verification }}">
{% endif %}
<!-- end _includes/seo.html -->
1 change: 0 additions & 1 deletion _pages/software/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ date: 2018-03-01T00:00:00+00:00
author_profile: false
layout: splash
permalink: /software/
excerpt: "Find the right software for your needs and start installing."
feature_row:
- image_path: /assets/images/odk-collect.jpg
alt: "Looking for a simple way to collect data and analyze the results?"
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
title: "The standard for mobile data collection"
layout: splash
permalink: /
date: 2018-03-01T00:00:00-00:00
Expand Down

0 comments on commit bc185e7

Please sign in to comment.