Skip to content

Commit

Permalink
feat(meta): Add Facebook and Twitter meta tags (#51)
Browse files Browse the repository at this point in the history
* feat(meta): Add Twitter-related meta tags

* fix(meta): Shorten title to fit into Twitter card

* feat(meta): Add `og:image`

* feat: Add new image for `og:` and Twitter meta

* feat: Twitter card is now large summary

* refactor(meta): `head` is now a function on the homepage, too
  • Loading branch information
Hanziness committed Dec 27, 2020
1 parent 1c8acb0 commit 7a8b337
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 55 deletions.
61 changes: 8 additions & 53 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export default {
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' },
{ hid: 'twitter:title', name: 'twitter:title', content: 'AnotherPomodoro' },
{ hid: 'twitter:description', name: 'twitter:description', content: process.env.npm_package_description || '' },
{ hid: 'twitter:image', name: 'twitter:image', content: '/img/ogImage.jpg' },
{ hid: 'og:image', property: 'og:image', content: '/img/ogImage.jpg' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
Expand Down Expand Up @@ -96,9 +100,10 @@ export default {
meta: {
name: 'AnotherPomodoro',
author: 'Imre Gera',
description: 'Free and open-source Pomodoro app for everyone',
description: 'Free and open-source Pomodoro app for everyone, right from your browser!',
theme_color: '#FF6B6B',
lang: 'en'
lang: 'en',
twitterCard: 'summary_large_image'
},
icon: {
fileName: 'icon.png',
Expand Down Expand Up @@ -181,56 +186,6 @@ export default {
]
]
}
},
extractCSS: {
ignoreOrder: true
},
optimizeCSS: {},
postcss: {
plugins: {
tailwindcss: require('tailwindcss'),
cssnano: {
preset: [
'default',
{
discardComments: { removeAll: true }
}
]
},
/*
TODO This is only needed while @nuxtjs/tailwindcss does not ship Tailwind V2
with PostCSS 8 by default.
See https://github.com/nuxt-community/tailwindcss-module/pull/203 and
https://github.com/tailwindlabs/tailwindcss/issues/1190#issuecomment-546621554.
*/
'postcss-preset-env': {
stage: 1,
features: {
'focus-within-pseudo-class': false
}
}
}
},
// optimization: {
// splitChunks: {
// chunks: 'all',
// cacheGroups: {
// styles: {
// name: true,
// priority: 10,
// test: /\.(s?css|vue)$/,
// chunks: 'all',
// minSize: 10000,
// reuseExistingChunk: true
// }
// }
// }
// },
extend (config, ctx) {
// enable source maps (inline on the server!)
if (ctx.isDev) {
config.devtool = ctx.isClient ? 'source-map' : 'inline-source-map'
}
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "pomodoro-app",
"description": "Free and open-source Pomodoro app for everyone, right from your browser!",
"version": "0.4.0",
"private": true,
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,10 @@ export default {
this.productImgIntersection.disconnect()
},
head: {
title: 'AnotherPomodoro'
head () {
return {
title: 'AnotherPomodoro'
}
}
}
</script>
Binary file added static/img/OgImage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7a8b337

Please sign in to comment.