← back to the blog @@ -43,6 +59,22 @@
diff --git a/keystone.js b/keystone.js index 061a9b7..8354c93 100644 --- a/keystone.js +++ b/keystone.js @@ -58,6 +58,8 @@ keystone.set('nav', { teams: ['teams', 'team-categories'] }); +keystone.set('baseUrl', 'https://shecodeafrica.org/'); + // Start Keystone to connect to your database and initialise the web server diff --git a/models/Post.js b/models/Post.js index be3933e..e664c26 100644 --- a/models/Post.js +++ b/models/Post.js @@ -33,5 +33,9 @@ Post.schema.virtual('content.full').get(function () { return this.content.extended || this.content.brief; }); +Post.schema.virtual('fullPostUrl').get(function () { + return keystone.get('baseUrl') + 'blog/post/' + this.slug; +}); + Post.defaultColumns = 'title, state|20%, author|20%, publishedDate|20%, pageView|20%'; Post.register(); diff --git a/public/styles/main.css b/public/styles/main.css index cfabaf8..3a504af 100644 --- a/public/styles/main.css +++ b/public/styles/main.css @@ -1060,7 +1060,7 @@ div.__shecodecard > div > div > div > p.__shecodevmvp1 { } .share button { - margin-top: 21px; + margin-top: 21px; width: 90px; height: 37px; } @@ -1259,6 +1259,80 @@ box-shadow: 0px 0px 7px #FF4EAE; } } +/* Social Share Buttons */ +@media (min-width:769px) { + .social-share-mobile { + display: none; + } +} + +.social-share-mobile ul { + padding-left: 0; +} + +.social-share-mobile ul li { + list-style: none; + display: inline-flex; + padding: 5px; +} + +.social-share-desktop { + display: none; +} + +@media (min-width:1024px) { + .social-share-desktop { + position: sticky; + position: -webkit-sticky; + bottom: 5rem; + top: 15rem; + display: block; + } + + .social-share-desktop ul li { + display: block; + } +} + +/* Social Button Styles */ +.social-share-icon { + border-radius: 50%; + padding: 12px; + font-size: 22px !important; + width: 50px; + height: 50px; + text-align: center; + text-decoration: none; + margin: 5px; + color: white; +} + +/* Hover Effect */ +.social-share-icon:hover { + opacity: 0.8; + text-align: center; + text-decoration: none; + color: white; +} +.social-share-icon:visited { + color: white; +} +.fa { + padding-top: 15px; +} +/* Brand Colors */ +.fa-facebook-f { + background: #3B5998; +} + +.fa-twitter { + background: #55ACEE; +} + +.fa-linkedin { + background: #007bb5; +} + /*job page*/ #job-content { margin: 50px 0; diff --git a/routes/middleware.js b/routes/middleware.js index 7cf4802..c61ca02 100644 --- a/routes/middleware.js +++ b/routes/middleware.js @@ -29,6 +29,8 @@ exports.initLocals = function(req, res, next) { // { label: 'Contact', key: 'contact', href: '/contact' }, ]; + // Initialise base url for full blog post links + res.locals.baseUrl = req.baseUrl; res.locals.user = req.user; next(); diff --git a/templates/views/blog.html b/templates/views/blog.html index 46165fe..38e8d71 100644 --- a/templates/views/blog.html +++ b/templates/views/blog.html @@ -1,4 +1,6 @@ -{% extends "layouts/default.html" %} {% macro blogPost(post) %} +{% extends "layouts/blog-default.html" %} + +{% macro blogPost(post) %}
← back to the blog @@ -43,6 +59,22 @@