mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Bring SEO features back into core and refactor SEO package into sitemap package
This commit is contained in:
parent
7f8795d7fe
commit
07125f900d
19 changed files with 102 additions and 103 deletions
|
@ -54,6 +54,7 @@ aslagle:reactive-table
|
|||
aramk:tinycolor
|
||||
fortawesome:fontawesome
|
||||
fourseven:scss
|
||||
manuelschoebel:ms-seo
|
||||
|
||||
# Testing
|
||||
|
||||
|
@ -90,7 +91,7 @@ telescope-releases
|
|||
telescope-getting-started
|
||||
telescope-subscribe-to-posts
|
||||
telescope-tagline-banner
|
||||
telescope-sitemap
|
||||
telescope-messages
|
||||
|
||||
# Custom Packages
|
||||
telescope-seo
|
||||
telescope-messages
|
||||
|
|
|
@ -133,8 +133,8 @@ telescope-post-by-feed@0.0.1
|
|||
telescope-releases@0.1.0
|
||||
telescope-rss@0.0.0
|
||||
telescope-search@0.0.0
|
||||
telescope-seo@0.0.5
|
||||
telescope-singleday@0.1.0
|
||||
telescope-sitemap@0.0.5
|
||||
telescope-subscribe-to-posts@0.1.0
|
||||
telescope-tagline-banner@0.1.0
|
||||
telescope-tags@0.0.0
|
||||
|
|
|
@ -12,4 +12,31 @@ Meteor.startup(function () {
|
|||
$('#rss-link').attr('title', i18n.t('new_posts'));
|
||||
});
|
||||
|
||||
// AutoForm.debug();
|
||||
// AutoForm.debug();
|
||||
|
||||
Meteor.startup(function() {
|
||||
|
||||
var seoProperties = {
|
||||
meta: {},
|
||||
og: {}
|
||||
}
|
||||
|
||||
var title = getSetting("title", "Telescope");
|
||||
if (!!getSetting("tagline")) {
|
||||
title += ": "+getSetting("tagline");
|
||||
}
|
||||
|
||||
seoProperties.title = title;
|
||||
|
||||
if (!!getSetting("description")) {
|
||||
seoProperties.meta.description = getSetting("description");
|
||||
seoProperties.og.description = getSetting("description");
|
||||
}
|
||||
|
||||
if (!!getSetting("siteImage")) {
|
||||
seoProperties.og.image = getSetting("siteImage");
|
||||
}
|
||||
|
||||
SEO.config(seoProperties);
|
||||
|
||||
});
|
|
@ -30,6 +30,15 @@ settingsSchemaObject = {
|
|||
instructions: 'A short description used for SEO purposes.'
|
||||
}
|
||||
},
|
||||
siteImage: {
|
||||
type: String,
|
||||
optional: true,
|
||||
regEx: SimpleSchema.RegEx.Url,
|
||||
autoform: {
|
||||
group: "general",
|
||||
instructions: "URL to an image for the open graph image tag for all pages"
|
||||
}
|
||||
},
|
||||
navLayout: {
|
||||
type: String,
|
||||
optional: true,
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
"faviconUrl": "Favicon URL",
|
||||
"mailURL": "MailURL",
|
||||
"postsLayout": "Posts Layout",
|
||||
"siteImage": "Site Image",
|
||||
|
||||
// Settings Fieldsets
|
||||
"general": "General",
|
||||
|
|
|
@ -131,10 +131,36 @@ Router._filters = {
|
|||
}
|
||||
},
|
||||
|
||||
setTitle: function () {
|
||||
// if getTitle is set, use it. Otherwise default to site title.
|
||||
var title = (typeof this.getTitle === 'function') ? this.getTitle() : getSetting("title", "Telescope");
|
||||
document.title = title;
|
||||
setSEOProperties: function () {
|
||||
|
||||
var props = {meta: {}, og: {}};
|
||||
var title = this.getTitle && this.getTitle();
|
||||
var description = this.getDescription && this.getDescription();
|
||||
var image = getSetting("siteImage");
|
||||
|
||||
if (!!title) {
|
||||
props.title = title + " | " + getSetting("title");
|
||||
}
|
||||
if (!!description) {
|
||||
props.meta.description = description;
|
||||
props.og.description = description;
|
||||
}
|
||||
if (!!image) {
|
||||
props.og.image = image;
|
||||
}
|
||||
console.log(props)
|
||||
|
||||
SEO.set(props);
|
||||
|
||||
},
|
||||
|
||||
setCanonical: function () {
|
||||
// note: disabled for now because the code below erases the page title
|
||||
|
||||
// var post = Posts.findOne(this.params._id);
|
||||
// if (post) {
|
||||
// SEO.set({link: {canonical: getPostPageUrl(post)}});
|
||||
// }
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -193,7 +219,8 @@ Meteor.startup( function (){
|
|||
// Router.onAfterAction(filters.resetScroll, {except:['posts_top', 'posts_new', 'posts_best', 'posts_pending', 'posts_category', 'all-users']});
|
||||
Router.onAfterAction(analyticsInit); // will only run once thanks to _.once()
|
||||
Router.onAfterAction(analyticsRequest); // log this request with mixpanel, etc
|
||||
Router.onAfterAction(filters.setTitle);
|
||||
Router.onAfterAction(filters.setSEOProperties);
|
||||
Router.onAfterAction(filters.setCanonical, {only: ["post_page", "post_page_with_slug"]});
|
||||
|
||||
// Unload Hooks
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ PostsListController = RouteController.extend({
|
|||
},
|
||||
|
||||
getTitle: function () {
|
||||
return i18n.t(this.view) + ' - ' + getSetting('title', "Telescope");
|
||||
return i18n.t(this.view);
|
||||
},
|
||||
|
||||
getDescription: function () {
|
||||
|
@ -98,7 +98,7 @@ Meteor.startup(function () {
|
|||
getTitle: function () {
|
||||
var title = getSetting('title', 'Telescope');
|
||||
var tagline = getSetting('tagline');
|
||||
var fullTitle = !!tagline ? title + ' – ' + tagline : title ;
|
||||
var fullTitle = !!tagline ? title + ': ' + tagline : title ;
|
||||
return fullTitle;
|
||||
}
|
||||
});
|
||||
|
@ -143,7 +143,7 @@ PostPageController = RouteController.extend({
|
|||
|
||||
getTitle: function () {
|
||||
if (!!this.post())
|
||||
return this.post().title + ' - ' + getSetting('title', "Telescope");
|
||||
return this.post().title;
|
||||
},
|
||||
|
||||
onBeforeAction: function() {
|
||||
|
|
|
@ -26,7 +26,7 @@ UserPageController = RouteController.extend({
|
|||
},
|
||||
|
||||
getTitle: function () {
|
||||
return getDisplayName(this.getUser()) + ' - ' + getSetting('title', "Telescope");
|
||||
return getDisplayName(this.getUser());
|
||||
},
|
||||
|
||||
getDescription: function () {
|
||||
|
|
|
@ -31,7 +31,7 @@ PostsDailyController = RouteController.extend({
|
|||
},
|
||||
|
||||
getTitle: function () {
|
||||
return i18n.t('daily') + ' - ' + getSetting('title', "Telescope");
|
||||
return i18n.t('daily');
|
||||
},
|
||||
|
||||
getDescription: function () {
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"siteImage": "Site Image"
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
Meteor.startup(function() {
|
||||
// Inject SEO tags.
|
||||
Router.onAfterAction(function() {
|
||||
var props = {meta: {}, og: {}};
|
||||
var title = this.getTitle && this.getTitle();
|
||||
var description = this.getDescription && this.getDescription();
|
||||
var image = getSetting("siteImage");
|
||||
if (title) {
|
||||
props.og.title = title;
|
||||
}
|
||||
if (description) {
|
||||
props.meta.description = description;
|
||||
props.og.description = description;
|
||||
}
|
||||
if (image) {
|
||||
props.og.image = image;
|
||||
}
|
||||
SEO.set(props);
|
||||
});
|
||||
|
||||
// Add canonical URL to post pages
|
||||
Router.onAfterAction(function() {
|
||||
var post = Posts.findOne(this.params._id);
|
||||
if (post) {
|
||||
SEO.set({link: {canonical: getPostPageUrl(post)}});
|
||||
}
|
||||
}, {only: ["post_page", "post_page_with_slug"]});
|
||||
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
// Add SEO settings.
|
||||
addToSettingsSchema.push({
|
||||
propertyName: "siteImage",
|
||||
propertySchema: {
|
||||
type: String,
|
||||
optional: true,
|
||||
regEx: SimpleSchema.RegEx.Url,
|
||||
autoform: {
|
||||
group: "general",
|
||||
instructions: "URL to an image for the open graph image tag for all pages"
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"translation_function_name": "__",
|
||||
"helper_name": "_",
|
||||
"namespace": "project"
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
Package.describe({
|
||||
name: "telescope-seo",
|
||||
summary: "SEO extensions for Telescope",
|
||||
version: "0.0.5"
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.use([
|
||||
"templating",
|
||||
"underscore",
|
||||
"aldeed:simple-schema",
|
||||
"tap:i18n",
|
||||
"iron:router",
|
||||
"telescope-lib",
|
||||
"telescope-base",
|
||||
"telescope-i18n",
|
||||
"manuelschoebel:ms-seo@0.4.1",
|
||||
"gadicohen:sitemaps@0.0.20"
|
||||
]);
|
||||
|
||||
// both
|
||||
api.addFiles([
|
||||
"lib/routes.js",
|
||||
"lib/seo.js",
|
||||
"package-tap.i18n"
|
||||
], ['client', 'server']);
|
||||
|
||||
// server
|
||||
api.addFiles([
|
||||
"lib/server/sitemaps.js"
|
||||
], ["server"]);
|
||||
|
||||
// i18n
|
||||
api.add_files([
|
||||
"i18n/en.i18n.json"
|
||||
], ["client", "server"]);
|
||||
|
||||
});
|
|
@ -15,7 +15,7 @@ PostsSingledayController = RouteController.extend({
|
|||
},
|
||||
|
||||
getTitle: function () {
|
||||
return i18n.t('single_day') + ' - ' + getSetting('title', 'Telescope');
|
||||
return i18n.t('single_day');
|
||||
},
|
||||
|
||||
getDescription: function () {
|
||||
|
|
22
packages/telescope-sitemap/package.js
Normal file
22
packages/telescope-sitemap/package.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
Package.describe({
|
||||
name: "telescope-sitemap",
|
||||
summary: "Sitemap package for Telescope",
|
||||
version: "0.0.5"
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.use([
|
||||
"templating",
|
||||
"underscore",
|
||||
"iron:router",
|
||||
"telescope-lib",
|
||||
"telescope-base",
|
||||
"gadicohen:sitemaps@0.0.20"
|
||||
]);
|
||||
|
||||
// server
|
||||
api.addFiles([
|
||||
"lib/server/sitemaps.js"
|
||||
], ["server"]);
|
||||
|
||||
});
|
Loading…
Add table
Reference in a new issue