0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Merge branch 'master' of github.com:/TryGhost/Ghost

This commit is contained in:
Hannah Wolfe 2013-09-17 22:48:18 +01:00
commit c51c7e197d
3 changed files with 36 additions and 1 deletions

View file

@ -101,6 +101,7 @@ function ghostLocals(req, res, next) {
// Make sure we have a locals value.
res.locals = res.locals || {};
res.locals.version = packageInfo.version;
res.locals.path = req.path;
if (res.isAdmin) {
_.extend(res.locals, {

View file

@ -78,7 +78,7 @@ adminControllers = {
tmp_path = req.files.uploadimage.path,
dir = path.join('content/images', year, month),
ext = path.extname(req.files.uploadimage.name).toLowerCase(),
basename = path.basename(req.files.uploadimage.name, ext);
basename = path.basename(req.files.uploadimage.name, ext).replace(/[\W]/gi, '_');
function renameFile(target_path) {
// adds directories recursively

View file

@ -218,6 +218,40 @@ coreHelpers = function (ghost) {
});
});
ghost.registerThemeHelper('meta_title', function (options) {
var title, blog;
blog = ghost.blogGlobals();
if (_.isString(this.path)) {
if (!this.path || this.path === '/' || this.path === '' || this.path.match(/\/page/)) {
blog = ghost.blogGlobals();
title = blog.title;
} else {
title = this.post.title;
}
}
return ghost.doFilter('meta_title', title, function (title) {
return new hbs.handlebars.SafeString(title.trim());
});
});
ghost.registerThemeHelper('meta_description', function (options) {
var description, blog;
blog = ghost.blogGlobals();
if (_.isString(this.path)) {
if (!this.path || this.path === '/' || this.path === '' || this.path.match(/\/page/)) {
blog = ghost.blogGlobals();
description = blog.description;
} else {
description = '';
}
}
return ghost.doFilter('meta_description', description, function (description) {
return new hbs.handlebars.SafeString(description.trim());
});
});
ghost.registerThemeHelper('ghost_foot', function (options) {
var foot = [];
foot.push('<script src="/shared/vendor/jquery/jquery.js"></script>');