Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
a7255c49
Commit
a7255c49
authored
Oct 20, 2015
by
Andrew Sliwinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GA tracking and optimize open graph tags
parent
03b3ae83
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
10 deletions
+42
-10
server/config.js
server/config.js
+17
-0
server/defaults.json
server/defaults.json
+0
-4
server/handler.js
server/handler.js
+3
-1
server/template.html
server/template.html
+22
-5
static/images/og_image.jpg
static/images/og_image.jpg
+0
-0
No files found.
server/config.js
0 → 100644
View file @
a7255c49
module
.
exports
=
{
// Search and metadata
title
:
'
Imagine, Program, Share
'
,
description
:
'
Scratch is a free programming language and online community
'
+
'
where you can create your own interactive stories, games,
'
+
'
and animations.
'
,
// Open graph
og_image
:
'
https://scratch.mit.edu/images/og_image.jpg
'
,
og_image_type
:
'
image/jpeg
'
,
og_image_width
:
986
,
og_image_height
:
860
,
// Analytics & Monitoring
ga_tracker
:
process
.
env
.
GA_TRACKER
||
''
};
server/defaults.json
deleted
100644 → 0
View file @
03b3ae83
{
"title"
:
"Imagine, Program, Share"
,
"description"
:
"Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations."
}
server/handler.js
View file @
a7255c49
...
@@ -4,12 +4,14 @@ var fs = require('fs');
...
@@ -4,12 +4,14 @@ var fs = require('fs');
var
mustache
=
require
(
'
mustache
'
);
var
mustache
=
require
(
'
mustache
'
);
var
path
=
require
(
'
path
'
);
var
path
=
require
(
'
path
'
);
var
config
=
require
(
'
./config
'
);
/**
/**
* Constructor
* Constructor
*/
*/
function
Handler
(
route
)
{
function
Handler
(
route
)
{
// Route definition
// Route definition
defaults
(
route
,
require
(
'
./defaults.json
'
)
);
defaults
(
route
,
config
);
// Render template
// Render template
var
location
=
path
.
resolve
(
__dirname
,
'
./template.html
'
);
var
location
=
path
.
resolve
(
__dirname
,
'
./template.html
'
);
...
...
server/template.html
View file @
a7255c49
...
@@ -10,13 +10,19 @@
...
@@ -10,13 +10,19 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Scratch - {{title}}
</title>
<title>
Scratch - {{title}}
</title>
<!-- Search & Open Graph-->
<meta
name=
"description"
content=
"{{description}}"
/>
<meta
name=
"description"
content=
"{{description}}"
/>
<meta
name=
"google-site-verification"
content=
"m_3TAXDreGTFyoYnEmU9mcKB4Xtw5mw6yRkuJtXRKxM"
/>
<!-- Open Graph -->
<meta
property=
"og:type"
content=
"website"
/>
<meta
property=
"og:url"
content=
"https://scratch.mit.edu/"
/>
<meta
property=
"og:url"
content=
"https://scratch.mit.edu/"
/>
<meta
property=
"og:type"
content=
"website"
/>
<meta
property=
"og:title"
content=
"Scratch - {{title}}"
/>
<meta
property=
"og:title"
content=
"Scratch - {{title}}"
/>
<meta
property=
"og:description"
content=
"Make games, stories and interactive art with Scratch. (scratch.mit.edu)"
/>
<meta
property=
"og:description"
content=
"{{description}}"
/>
<meta
property=
"og:image"
content=
"{{&og_image}}"
/>
<meta
property=
"og:image:type"
content=
"{{&og_image_type}}"
/>
<meta
property=
"og:image:width"
content=
"{{&og_image_width}}"
/>
<meta
property=
"og:image:height"
content=
"{{&og_image_height}}"
/>
<!-- Favicon & CSS normalize -->
<!-- Favicon & CSS normalize -->
<link
rel=
"shortcut icon"
href=
"/favicon.ico"
/>
<link
rel=
"shortcut icon"
href=
"/favicon.ico"
/>
...
@@ -41,8 +47,19 @@
...
@@ -41,8 +47,19 @@
<script
src=
"/js/main.bundle.js"
></script>
<script
src=
"/js/main.bundle.js"
></script>
<script
src=
"/js/{{view}}.bundle.js"
></script>
<script
src=
"/js/{{view}}.bundle.js"
></script>
<!-- @todo Analytics (GA) -->
<!-- Analytics (GA) -->
<!-- @todo Monitoring (Raven) -->
<script>
(
function
(
i
,
s
,
o
,
g
,
r
,
a
,
m
){
i
[
'
GoogleAnalyticsObject
'
]
=
r
;
i
[
r
]
=
i
[
r
]
||
function
(){
(
i
[
r
].
q
=
i
[
r
].
q
||
[]).
push
(
arguments
)},
i
[
r
].
l
=
1
*
new
Date
();
a
=
s
.
createElement
(
o
),
m
=
s
.
getElementsByTagName
(
o
)[
0
];
a
.
async
=
1
;
a
.
src
=
g
;
m
.
parentNode
.
insertBefore
(
a
,
m
)
})(
window
,
document
,
'
script
'
,
'
//www.google-analytics.com/analytics.js
'
,
'
ga
'
);
ga
(
'
create
'
,
'
{{&ga_tracker}}
'
,
{
'
sampleRate
'
:
10
});
ga
(
'
send
'
,
'
pageview
'
);
</script>
<!-- @todo New Relic -->
<!-- @todo New Relic -->
</body>
</body>
</html>
</html>
static/images/og_image.jpg
0 → 100644
View file @
a7255c49
212 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment