Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
eth-landing-page
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Erick Hitter
eth-landing-page
Commits
557aeb70
Verified
Commit
557aeb70
authored
Dec 25, 2016
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Insert render latest post into document
parent
1fc35843
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
4 deletions
+29
-4
index.js
index.js
+5
-1
public/css/main.css
public/css/main.css
+1
-0
public/js/main.js
public/js/main.js
+14
-0
render/partials/post.handlebars
render/partials/post.handlebars
+2
-2
render/partials/sites.handlebars
render/partials/sites.handlebars
+1
-1
render/templates/main.handlebars
render/templates/main.handlebars
+6
-0
No files found.
index.js
View file @
557aeb70
...
...
@@ -25,11 +25,12 @@ app.get( '/', function( req, res ) {
res
.
render
(
'
index
'
,
{
data
:
{
domains
:
domains
}
}
);
}
);
//
Get some data
//
API requests require a domain
app
.
get
(
'
/api
'
,
function
(
req
,
res
)
{
res
.
status
(
400
).
json
(
{
error
:
'
Must specify a domain!
'
}
);
}
);
// Render the domain's latest post
app
.
get
(
'
/api/:domain
'
,
function
(
req
,
res
)
{
// For convenience
var
domain
=
req
.
params
.
domain
;
...
...
@@ -61,6 +62,9 @@ app.get( '/api/:domain', function( req, res ) {
}
);
}
);
// Allow access to scripts
app
.
use
(
express
.
static
(
'
public
'
)
);
// Listen on some random, unused port
// App is meant to be fronted by nginx
app
.
listen
(
5060
,
function
()
{
...
...
public/css/main.css
0 → 100644
View file @
557aeb70
.sharedaddy
{
display
:
none
;
}
public/js/main.js
0 → 100644
View file @
557aeb70
(
function
(
$
)
{
$
(
'
div.site-container
'
).
each
(
function
(
i
,
site
)
{
var
container
=
$
(
this
),
domain
=
container
.
data
(
'
domain
'
);
$
.
get
(
{
url
:
'
/api/
'
+
domain
,
success
:
function
(
data
,
status
)
{
$
(
'
.latest-post
'
,
container
).
html
(
data
);
}
}
);
}
);
}
)
(
jQuery
);
render/partials/post.handlebars
View file @
557aeb70
<h3><a
href=
"
{{
data
.
post
.
link
}}
"
>
{{
data
.
post
.
title
.
rendered
}}
</a></h3>
<h3><a
href=
"
{{
data
.
post
.
link
}}
"
>
{{
{
data
.
post
.
title
.
rendered
}
}}
</a></h3>
{{{
data
.
post
.
excerpt
.
rendered
}}}
<p><a
href=
"
{{
data
.
post
.
link
}}
"
>
Read at
{{
data
.
domain
}}
→
</a></p>
<p><a
href=
"
{{
data
.
post
.
link
}}
"
>
Read at
{{
data
.
domain
}}
→
</a></p>
render/partials/sites.handlebars
View file @
557aeb70
{{#
each
data
.
domains
}}
<div
class=
"site-container"
id=
"site-
{{
@key
}}
"
>
<div
class=
"site-container"
id=
"site-
{{
@key
}}
"
data-domain=
"
{{
@key
}}
"
>
<h2><a
href=
"
{{
this
}}
"
>
{{
this
}}
</a></h2>
<span
class=
"latest-post"
>
Loading
…
</span>
</div>
...
...
render/templates/main.handlebars
View file @
557aeb70
...
...
@@ -2,6 +2,10 @@
<html>
<head>
<title>
erick t. hitter's latest posts
</title>
<script
src=
"https://s2.e15r.co/wp-includes/js/jquery/jquery.js"
></script>
<link
rel=
"stylesheet"
href=
"css/main.css"
/>
</head>
<body>
{{{
body
}}}
...
...
@@ -10,6 +14,8 @@
{{>
sites
}}
</div>
<script
src=
"js/main.js"
></script>
{{>
analytics
}}
</body>
</html>
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