Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
2b9c9225a5 | |||
5ce55190fe | |||
8fb071f57b | |||
3278ef7425 | |||
11282daa38 | |||
1fe7dd8d06 | |||
9175cb7841 | |||
6b9ebcec7a |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "3.0.11",
|
"version": "3.0.15",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "3.0.11",
|
"version": "3.0.15",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "setup basic page properties",
|
"description": "setup basic page properties",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -2,3 +2,4 @@ export * from './websetup.classes.websetup';
|
|||||||
export * from './websetup.classes.tag.metatag';
|
export * from './websetup.classes.tag.metatag';
|
||||||
export * from './websetup.classes.tag.opengraphtag';
|
export * from './websetup.classes.tag.opengraphtag';
|
||||||
export * from './websetup.classes.tag.jsonldtag';
|
export * from './websetup.classes.tag.jsonldtag';
|
||||||
|
export * from './websetup.classes.title';
|
||||||
|
@ -3,8 +3,18 @@ import * as plugins from '../websetup.plugins';
|
|||||||
export interface IMetaObject {
|
export interface IMetaObject {
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
twitterHandle?: string;
|
|
||||||
canonicalDomain?: string;
|
canonicalDomain?: string;
|
||||||
ldCompany?: plugins.tsclass.business.ICompany;
|
ldCompany?: plugins.tsclass.business.ICompany;
|
||||||
ldProduct?: any;
|
ldProduct?: any;
|
||||||
|
|
||||||
|
// handles
|
||||||
|
twitterHandle?: string;
|
||||||
|
facebookHandle?: string;
|
||||||
|
|
||||||
|
// links
|
||||||
|
companyWebsiteLink?: string;
|
||||||
|
googleNewsLink?: string;
|
||||||
|
mediumLink?: string;
|
||||||
|
slackLink?: string;
|
||||||
|
airmeetLink?: string;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import * as plugins from './websetup.plugins';
|
|||||||
import { Tag } from './websetup.classes.tag';
|
import { Tag } from './websetup.classes.tag';
|
||||||
|
|
||||||
export class OpengraphTag extends Tag {
|
export class OpengraphTag extends Tag {
|
||||||
public static createNewsArticleOgTags (newsArticleArg: plugins.tsclass.content.IArticle) {
|
public static createNewsArticleOgTags(newsArticleArg: plugins.tsclass.content.IArticle) {
|
||||||
const tagArray: OpengraphTag[] = [];
|
const tagArray: OpengraphTag[] = [];
|
||||||
tagArray.push(new OpengraphTag('og:url', newsArticleArg.url));
|
tagArray.push(new OpengraphTag('og:url', newsArticleArg.url));
|
||||||
tagArray.push(new OpengraphTag('og:title', newsArticleArg.title));
|
tagArray.push(new OpengraphTag('og:title', newsArticleArg.title));
|
||||||
|
@ -16,7 +16,7 @@ export class TagManager {
|
|||||||
// global tag level
|
// global tag level
|
||||||
this.globalLevel.addTag(new MetaTag('google', 'notranslate'));
|
this.globalLevel.addTag(new MetaTag('google', 'notranslate'));
|
||||||
this.globalLevel.addTag(new MetaTag('revisit-after', '1 days'));
|
this.globalLevel.addTag(new MetaTag('revisit-after', '1 days'));
|
||||||
|
|
||||||
if (metaObjectArg.twitterHandle) {
|
if (metaObjectArg.twitterHandle) {
|
||||||
this.globalLevel.addTag(new MetaTag('twitter:card', 'summary_large_image'));
|
this.globalLevel.addTag(new MetaTag('twitter:card', 'summary_large_image'));
|
||||||
this.globalLevel.addTag(new MetaTag('twitter:site', metaObjectArg.twitterHandle));
|
this.globalLevel.addTag(new MetaTag('twitter:site', metaObjectArg.twitterHandle));
|
||||||
|
9
ts/websetup.classes.title.ts
Normal file
9
ts/websetup.classes.title.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import * as plugins from './websetup.plugins';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a title proxy class
|
||||||
|
* --> to be used in the future when flashing titles is supported
|
||||||
|
*/
|
||||||
|
export class Title {
|
||||||
|
|
||||||
|
}
|
@ -5,6 +5,7 @@ import { TagLevel } from './websetup.classes.taglevel';
|
|||||||
|
|
||||||
export interface IWebSetupConstructorOptions {
|
export interface IWebSetupConstructorOptions {
|
||||||
metaObject: interfaces.IMetaObject;
|
metaObject: interfaces.IMetaObject;
|
||||||
|
smartssrWaitForReadySignal?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,12 +14,21 @@ export interface IWebSetupConstructorOptions {
|
|||||||
export class WebSetup {
|
export class WebSetup {
|
||||||
public tagManager: TagManager = new TagManager();
|
public tagManager: TagManager = new TagManager();
|
||||||
public options: IWebSetupConstructorOptions;
|
public options: IWebSetupConstructorOptions;
|
||||||
|
|
||||||
|
// private deferreds
|
||||||
private readyDeferred = plugins.smartpromise.defer();
|
private readyDeferred = plugins.smartpromise.defer();
|
||||||
|
private readyForSmartssrDeferred = plugins.smartpromise.defer();
|
||||||
|
|
||||||
|
// public promises
|
||||||
public readyPromise = this.readyDeferred.promise;
|
public readyPromise = this.readyDeferred.promise;
|
||||||
|
public readyForSmartssrPromise = this.readyForSmartssrDeferred.promise;
|
||||||
constructor(optionsArg: IWebSetupConstructorOptions) {
|
constructor(optionsArg: IWebSetupConstructorOptions) {
|
||||||
this.options = optionsArg;
|
this.options = optionsArg;
|
||||||
this.setup().then(() => {
|
this.setup().then(() => {
|
||||||
this.readyDeferred.resolve();
|
this.readyDeferred.resolve();
|
||||||
|
if (!this.options.smartssrWaitForReadySignal) {
|
||||||
|
this.readyForSmartssrDeferred.resolve();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,5 +58,19 @@ export class WebSetup {
|
|||||||
return subLevel;
|
return subLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flashes the title with the given text
|
||||||
|
* @param flashTextArg
|
||||||
|
*/
|
||||||
public flashTitle(flashTextArg: string) {}
|
public flashTitle(flashTextArg: string) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* informs smartssr that the page is ready to be rendered
|
||||||
|
*/
|
||||||
|
public informReadyForSmartssr() {
|
||||||
|
if (!this.options.smartssrWaitForReadySignal) {
|
||||||
|
console.error(`You have not indicated that you inform smartssr by a dedicated signal! Please consider doing so!`);
|
||||||
|
}
|
||||||
|
this.readyForSmartssrDeferred.resolve();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user