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

add twitter and open graph cards #428

Merged
merged 2 commits into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/resources/send-fb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/resources/send-twitter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ function prodLangs() {

const availableLanguages = conf.l10n_dev ? allLangs() : prodLangs();

const envURL = (env) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using this to set the URL so this can be tested on dev environments. Not super familiar with convict, but maybe this would be better done in config

switch (env) {
case 'test':
return 'https://send.stage.mozaws.net';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this is a thing.
I have a feeling that stage would use an env of "production". Not sure what [if anything] uses the "test" NODE_ENV, unless Circle-CI somehow sets it to that, but I strangely kind of doubt it.

I don't know how to tell the detect whether we're running on stage vs prod on the server.

case 'development':
return 'https://testpilot.dev.mozaws.net';
}
return 'https://send.firefox.com';
}

if (conf.env === 'development') {
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
Expand All @@ -58,7 +68,10 @@ app.engine(
partialsDir: 'views/partials/',
helpers: {
availableLanguages,
l10nDev: conf.l10n_dev
l10nDev: conf.l10n_dev,
envURL: envURL(conf.env),
title: 'Firefox Send',
description: 'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, this doesn't get localized, maybe that's not possible...

}
})
);
Expand Down
12 changes: 11 additions & 1 deletion views/layouts/main.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@
<meta name="defaultLanguage" content="en-US">
<meta name="availableLanguages" content="{{availableLanguages}}">

<title>Firefox Send</title>
<meta property="og:title" content="Firefox Send"/>
<meta name="twitter:title" content="Firefox Send"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It may be nice to use {{title}} here too for maximum efficiency. But merging is fun too and that could be micro-optimized later.

<meta name="description" content="{{description}}"/>
<meta property="og:description" content="{{description}}"/>
<meta name="twitter:description" content="{{description}}"/>
<meta name="twitter:card" content="summary"/>
<meta property="og:image" content="{{envURL}}/resources/send-fb.jpg"/>
<meta name="twitter:image" content="{{envURL}}/resources/send-twitter.jpg"/>
<meta property="og:url" content="{{envURL}}"/>

<title>{{title}}</title>

<link rel="stylesheet" type="text/css" href="/main.css" />
{{#if fira}}
Expand Down