Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #22 from matfin/develop
Browse files Browse the repository at this point in the history
Meta tags
  • Loading branch information
matfin committed Jun 24, 2017
2 parents 03c926e + bddf8c8 commit bb9fa0e
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion site/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ params:
description: "Photography website"
author: "Matt Finucane"
cl_media_base: "https://res.cloudinary.com/matt-finucane-portfolio/"
intro_photo: "berlin-expo-messe-nord.md"
intro_photo: "city/berlin-expo-messe-nord.md"
noindex: true

menu:
Expand Down
2 changes: 1 addition & 1 deletion site/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ params:
description: "Photography website"
author: "Matt Finucane"
cl_media_base: "https://res.cloudinary.com/matt-finucane-portfolio/"
intro_photo: "berlin-expo-messe-nord.md"
intro_photo: "city/berlin-expo-messe-nord.md"
noindex: true

menu:
Expand Down
1 change: 1 addition & 0 deletions site/layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "head" . }}
{{ partial "meta_tags" . }}
</head>
<body>
{{ partial "header" . }}
Expand Down
1 change: 1 addition & 0 deletions site/layouts/albums/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "head" . }}
{{ partial "meta_tags" . }}
</head>
<body>
{{ partial "header" . }}
Expand Down
1 change: 1 addition & 0 deletions site/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "head" . }}
{{ partial "meta_tags" . }}
</head>
<body>
{{ partial "header" . }}
Expand Down
31 changes: 31 additions & 0 deletions site/layouts/partials/meta_tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:type" content="website">
<meta property="og:locale" content="en-ie">
<meta property="og:title" content="{{ .Title }}">

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@matfinucane" />
<meta name="twitter:creator" content="@matfinucane" />

<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:url" content="{{ .Permalink }}" />

{{ $base := .Site.Params.cl_media_base }}
{{ if eq .Type "photos" }}
{{ $photo := . }}
{{ $cl_public_id := string $photo.Params.cl_public_id }}
{{ $cl_version := string $photo.Params.cl_version }}
<meta property="og:description" content="{{ .Params.title }} &ndash; {{ .Params.location }} &ndash; {{ dateFormat "January 2006" .Params.date }}">
<meta property="og:image" content="{{ $base }}image/upload/w_1280/v{{ $cl_version }}/{{ $cl_public_id }}.jpg">
<meta name="twitter:image:src" content="{{ $base }}image/upload/w_1280/v{{ $cl_version }}/{{ $cl_public_id }}.jpg" />
<meta name="twitter:description" content="{{ .Params.title }} &ndash; {{ .Params.location }} &ndash; {{ dateFormat "January 2006" .Params.date }}" />
{{ else }}
{{ $photo := .Site.GetPage "page" "photos" .Site.Params.intro_photo }}
{{ $cl_public_id := string $photo.Params.cl_public_id }}
{{ $cl_version := string $photo.Params.cl_version }}
<meta property="og:description" content="{{ .Params.description }}">
<meta name="og:image" content="{{ $base }}image/upload/w_1280/v{{ $cl_version }}/{{ $cl_public_id }}.jpg">
<meta name="twitter:image:src" content="{{ $base }}image/upload/w_1280/v{{ $cl_version }}/{{ $cl_public_id }}.jpg" />
<meta name="twitter:description" content="{{ .Params.description }}">
{{ end }}
Empty file.
1 change: 1 addition & 0 deletions site/layouts/photos/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "head" . }}
{{ partial "meta_tags" . }}
</head>
<body>
{{ partial "header" . }}
Expand Down
2 changes: 1 addition & 1 deletion site/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ params:
description: "Photography website"
author: "Matt Finucane"
cl_media_base: "https://res.cloudinary.com/matt-finucane-portfolio/"
intro_photo: "berlin-expo-messe-nord.md"
intro_photo: "city/berlin-expo-messe-nord.md"

menu:
main:
Expand Down
2 changes: 1 addition & 1 deletion site/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ params:
description: "Photography website"
author: "Matt Finucane"
cl_media_base: "https://res.cloudinary.com/matt-finucane-portfolio/"
intro_photo: "berlin-expo-messe-nord.md"
intro_photo: "city/berlin-expo-messe-nord.md"
noindex: true

menu:
Expand Down

0 comments on commit bb9fa0e

Please sign in to comment.