0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Aliased {{@blog}} as {{@site}} in the theme API

- we're going to remove @blog in Ghost 3.0 in favour of @site
- @site is the theme-layer equivalent of the Content API settings endpoint
This commit is contained in:
Hannah Wolfe 2019-01-03 17:52:37 +00:00 committed by Hannah Wolfe
parent 652e818cae
commit dd1cf5ffc7
6 changed files with 12 additions and 11 deletions

View file

@ -29,7 +29,7 @@
{{#post}}
<header class="main-header">
<nav class="blog-title">
<a href="{{@blog.url}}">{{@blog.title}}</a>
<a href="{{@site.url}}">{{@site.title}}</a>
</nav>
</header>
@ -58,7 +58,7 @@
</main>
{{/post}}
<footer class="site-footer clearfix">
<section class="copyright"><a href="{{@blog.url}}">{{@blog.title}}</a> &copy; {{date format="YYYY"}}</section>
<section class="copyright"><a href="{{@site.url}}">{{@site.title}}</a> &copy; {{date format="YYYY"}}</section>
<section class="poweredby">Proudly published with <a href="https://ghost.org">Ghost</a></section>
</footer>
</body>

View file

@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>{{@blog.title}} - Private Site Access</title>
<title>{{@site.title}} - Private Site Access</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">

View file

@ -24,7 +24,7 @@
<div class="gh-flow">
<header class="gh-flow-head">
<nav class="gh-flow-nav">
<a href="{{#if subscribed_url}}{{subscribed_url}}{{else}}{{@blog.url}}{{/if}}" class="gh-flow-back">
<a href="{{#if subscribed_url}}{{subscribed_url}}{{else}}{{@site.url}}{{/if}}" class="gh-flow-back">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="17px" height="27px" viewBox="0 0 17 27" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
@ -46,7 +46,7 @@
<section class="gh-flow-content">
{{^if success}}
<header>
<h1>Subscribe to {{@blog.title}}</h1>
<h1>Subscribe to {{@site.title}}</h1>
</header>
{{subscribe_form
@ -62,7 +62,7 @@
</header>
<p>
You've successfully subscribed to <em>{{@blog.title}}</em>
You've successfully subscribed to <em>{{@site.title}}</em>
with the email address <em>{{email}}</em>.
</p>
{{/if}}

View file

@ -45,7 +45,7 @@ themeMiddleware.ensureActiveTheme = function ensureActiveTheme(req, res, next) {
themeMiddleware.updateTemplateData = function updateTemplateData(req, res, next) {
// Static information, same for every request unless the settings change
// @TODO: bind this once and then update based on events?
var blogData = settingsCache.getPublic(),
var siteData = settingsCache.getPublic(),
labsData = _.cloneDeep(settingsCache.get('labs')),
themeData = {};
@ -66,7 +66,7 @@ themeMiddleware.updateTemplateData = function updateTemplateData(req, res, next)
// Request-specific information
// These things are super dependent on the request, so they need to be in middleware
// Serve the blog url without trailing slash
blogData.url = urlService.utils.urlFor('home', {secure: req.secure, trailingSlash: false}, true);
siteData.url = urlService.utils.urlFor('home', {secure: req.secure, trailingSlash: false}, true);
// Pass 'secure' flag to the view engine
// so that templates can choose to render https or http 'url', see url utility
@ -75,7 +75,8 @@ themeMiddleware.updateTemplateData = function updateTemplateData(req, res, next)
// @TODO: only do this if something changed?
hbs.updateTemplateOptions({
data: {
blog: blogData,
blog: siteData,
site: siteData,
labs: labsData,
config: themeData
}

View file

@ -316,7 +316,7 @@ function urlFor(context, data, absolute) {
urlPath = getBlogUrl(secure);
// CASE: there are cases where urlFor('home') needs to be returned without trailing
// slash e. g. the `{{@blog.url}}` helper. See https://github.com/TryGhost/Ghost/issues/8569
// slash e. g. the `{{@site.url}}` helper. See https://github.com/TryGhost/Ghost/issues/8569
if (data && data.trailingSlash === false) {
urlPath = urlPath.replace(/\/$/, '');
}

View file

@ -32,7 +32,7 @@
<section class="error-message">
<h1 class="error-code">{{statusCode}}</h1>
<h2 class="error-description">{{message}}</h2>
<a class="error-link" href="{{@blog.url}}">Go to the front page →</a>
<a class="error-link" href="{{@site.url}}">Go to the front page →</a>
</section>
</section>
</section>