Skip to content

Commit

Permalink
Fixes share image
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed May 26, 2016
1 parent d8b2cc4 commit ce9cce4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions docpad.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ module.exports =
return @getLang().slogan

getUrl: ->
if @document.url
return @document.url
if @document.pageurl
return @document.pageurl
else
return @getLang().url

getImageUrl: ->
if @document.imageurl
return @document.imageurl
else
return 'https://browserdiet.com/assets/img/fb-diet.jpg'

# =================================
# Environments

Expand Down
Binary file added src/documents/assets/img/fb-calories.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
2 changes: 2 additions & 0 deletions src/documents/calories/index.html.eco
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: 'Browser Calories'
slogan: 'The easiest way to measure your performance budget'
layout: default
imageurl: https://browserdiet.com/assets/img/fb-calories.jpg
pageurl: https://browserdiet.com/calories
---

<div id="header">
Expand Down
9 changes: 7 additions & 2 deletions src/layouts/default.html.eco
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@

<!-- Schema.org -->
<meta itemprop="name" content="<%= @getTitle() %>">
<meta itemprop="url" content="<%= @getUrl() %>">
<meta itemprop="image" content="<%= @site.assets %>/img/share.jpg">
<meta itemprop="description" content="<%= @getSlogan() %>">
<meta itemprop="url" content="<%= @getUrl() %>">
<meta itemprop="image" content="<%= @getImageUrl() %>">

<meta property="og:title" content="<%= @getTitle() %>">
<meta property="og:description" content="<%= @getSlogan() %>">
<meta property="og:url" content="<%= @getUrl() %>">
<meta property="og:image" content="<%= @getImageUrl() %>">

<!-- Style -->
<link rel="stylesheet" href="<%= @site.assets %>/css/main.css">
Expand Down

0 comments on commit ce9cce4

Please sign in to comment.