Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
782c9cd740 | |||
b8ab19a683 | |||
e47869caed | |||
4f06c5d7c5 | |||
c0d223959d | |||
c40c01b5c8 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "3.0.4",
|
"version": "3.0.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "3.0.4",
|
"version": "3.0.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "setup basic page properties",
|
"description": "setup basic page properties",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -63,6 +63,8 @@ export class JsonLdTag extends Tag {
|
|||||||
},
|
},
|
||||||
"description": newsArticleArg.author.firstName
|
"description": newsArticleArg.author.firstName
|
||||||
};
|
};
|
||||||
|
const ldTag = new JsonLdTag(newsArticleArg);
|
||||||
|
return ldTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(ldObjectArg: any) {
|
constructor(ldObjectArg: any) {
|
||||||
|
@ -6,6 +6,8 @@ import * as plugins from './websetup.plugins';
|
|||||||
|
|
||||||
export type TBaseLevelType = 'global' | 'base' | 'subpage';
|
export type TBaseLevelType = 'global' | 'base' | 'subpage';
|
||||||
|
|
||||||
|
export type TLevelState = 'enabled' | 'disabled';
|
||||||
|
|
||||||
export class TagLevel {
|
export class TagLevel {
|
||||||
public tagManagerRef: TagManager;
|
public tagManagerRef: TagManager;
|
||||||
|
|
||||||
@ -13,12 +15,17 @@ export class TagLevel {
|
|||||||
public type: TBaseLevelType;
|
public type: TBaseLevelType;
|
||||||
public tags: Tag[] = [];
|
public tags: Tag[] = [];
|
||||||
|
|
||||||
|
public state: TLevelState = 'disabled';
|
||||||
|
|
||||||
constructor(tagManagerRefArg: TagManager, levelType: TBaseLevelType) {
|
constructor(tagManagerRefArg: TagManager, levelType: TBaseLevelType) {
|
||||||
this.tagManagerRef = tagManagerRefArg;
|
this.tagManagerRef = tagManagerRefArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public addTag(tagArg: Tag) {
|
public addTag(tagArg: Tag) {
|
||||||
this.tags.push(tagArg);
|
this.tags.push(tagArg);
|
||||||
|
if (this.state === 'enabled') {
|
||||||
|
tagArg.appendToDom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async addCompanyInfo(companyDataArg: plugins.tsclass.business.ICompany) {
|
public async addCompanyInfo(companyDataArg: plugins.tsclass.business.ICompany) {
|
||||||
@ -52,7 +59,9 @@ export class TagLevel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addPostInfo() {}
|
public addNewsArticleInfo(articleArg: plugins.tsclass.content.IArticle) {
|
||||||
|
this.addTag(JsonLdTag.createNewsArticleLd(articleArg));
|
||||||
|
}
|
||||||
|
|
||||||
public async enable() {
|
public async enable() {
|
||||||
if (this.title) {
|
if (this.title) {
|
||||||
@ -61,11 +70,13 @@ export class TagLevel {
|
|||||||
for (const tagArg of this.tags) {
|
for (const tagArg of this.tags) {
|
||||||
tagArg.appendToDom();
|
tagArg.appendToDom();
|
||||||
}
|
}
|
||||||
|
this.state = 'enabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
public async disable() {
|
public async disable() {
|
||||||
for (const tagArg of this.tags) {
|
for (const tagArg of this.tags) {
|
||||||
tagArg.removeFromDom();
|
tagArg.removeFromDom();
|
||||||
}
|
}
|
||||||
|
this.state = 'disabled';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ export class TagManager {
|
|||||||
this.activeLevel.disable();
|
this.activeLevel.disable();
|
||||||
this.activeLevel = subPageLevel;
|
this.activeLevel = subPageLevel;
|
||||||
this.activeLevel.enable();
|
this.activeLevel.enable();
|
||||||
|
return subPageLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public revertToBaseLevel() {
|
public revertToBaseLevel() {
|
||||||
|
@ -38,7 +38,9 @@ export class WebSetup {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sets a subpage
|
* sets a subpage
|
||||||
* @param metaObject
|
* @param metaObjectArg
|
||||||
*/
|
*/
|
||||||
public setSubLevel(metaObject: interfaces.IMetaObject) {}
|
public setSubLevel(metaObjectArg: interfaces.IMetaObject) {
|
||||||
|
return this.tagManager.setSubPageLevel(metaObjectArg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user