Skip to content

Commit

Permalink
fix loading seo sub class
Browse files Browse the repository at this point in the history
  • Loading branch information
FunixG committed Sep 20, 2023
1 parent aa78445 commit 8aa8917
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 51 deletions.
17 changes: 11 additions & 6 deletions src/app/components/pacifista-page/pacifista-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, OnInit, Renderer2} from "@angular/core";
import {Component, OnInit} from "@angular/core";
import {Title} from "@angular/platform-browser";

@Component({ template: ''})
Expand All @@ -9,8 +9,13 @@ export abstract class PacifistaPage implements OnInit {
protected pageDescription: string = "Bienvenue sur Pacifista, le serveur Minecraft français survie créatif en 1.19 ! Rejoignez une communauté bienveillante, profitez d'un staff attentif et découvrez nos plugins faits maison.";
protected pageImage: string = 'https://pacifista.fr/assets/img/pacifista-logo.webp';

/**
* seo
* @param titleService the titleServiceManager
* @param doc Inject(DOCUMENT) private doc: Document
*/
constructor(protected titleService: Title,
protected renderer: Renderer2) {
private doc: Document) {
}

ngOnInit(): void {
Expand All @@ -29,10 +34,10 @@ export abstract class PacifistaPage implements OnInit {
}

private updateCanonicalPath(): void {
const canonical = this.renderer.createElement('link');
const canonical = this.doc.createElement('link');
canonical.setAttribute('rel', 'canonical');
canonical.setAttribute('href', 'https://pacifista.fr/' + this.canonicalPath);
this.renderer.appendChild(document.head, canonical);
this.doc.head.appendChild(canonical);
}

private updateMetaTags(): void {
Expand All @@ -50,11 +55,11 @@ export abstract class PacifistaPage implements OnInit {
}

private setMetaTag(name: string, content: string): void {
const meta = this.renderer.createElement('meta');
const meta = this.doc.createElement('meta');
meta.setAttribute('name', name);
meta.setAttribute('property', name);
meta.setAttribute('content', content);
this.renderer.appendChild(document.head, meta);
this.doc.head.appendChild(meta);
}

}
7 changes: 4 additions & 3 deletions src/app/pages/accueil/accueil.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {Title} from "@angular/platform-browser";
import {PacifistaPage} from "../../components/pacifista-page/pacifista-page";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-accueil',
Expand All @@ -10,8 +11,8 @@ import {PacifistaPage} from "../../components/pacifista-page/pacifista-page";
export class AccueilComponent extends PacifistaPage {

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
7 changes: 4 additions & 3 deletions src/app/pages/join/join.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {Title} from "@angular/platform-browser";
import {PacifistaPage} from "../../components/pacifista-page/pacifista-page";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-join',
Expand All @@ -14,8 +15,8 @@ export class JoinComponent extends PacifistaPage {
protected override readonly pageDescription: string = 'Découvrez comment rejoindre Pacifista en 1.19 : votre guide pour jouer sur notre serveur Minecraft survie, créatif français !';

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
7 changes: 4 additions & 3 deletions src/app/pages/legal/cgu/cgu.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {Title} from "@angular/platform-browser";
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-cgu',
Expand All @@ -14,8 +15,8 @@ export class CguComponent extends PacifistaPage {
protected override readonly pageDescription: string = "Conditions générales d'utilisation de Pacifista.";

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
7 changes: 4 additions & 3 deletions src/app/pages/legal/cgv/cgv.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {Title} from "@angular/platform-browser";
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-cgv',
Expand All @@ -14,8 +15,8 @@ export class CgvComponent extends PacifistaPage {
protected override readonly pageDescription: string = 'Conditions générales de vente de Pacifista.';

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
8 changes: 4 additions & 4 deletions src/app/pages/news/news-list-page/news-list-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AfterViewInit, Component, Inject, PLATFORM_ID, Renderer2} from '@angular/core';
import {AfterViewInit, Component, Inject, PLATFORM_ID} from '@angular/core';
import {Title} from "@angular/platform-browser";
import {faTwitter} from "@fortawesome/free-brands-svg-icons";
import NotificationService from "../../../services/notifications/services/NotificationService";
Expand All @@ -12,7 +12,7 @@ import {
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {HttpClient} from "@angular/common/http";
import {environment} from "../../../../environments/environment";
import {isPlatformBrowser} from "@angular/common";
import {DOCUMENT, isPlatformBrowser} from "@angular/common";

@Component({
selector: 'app-news-list-page',
Expand All @@ -39,9 +39,9 @@ export class NewsListPageComponent extends PacifistaPage implements AfterViewIni
constructor(private notificationService: NotificationService,
@Inject(PLATFORM_ID) private platfomId: Object,
titleService: Title,
renderer: Renderer2,
@Inject(DOCUMENT) doc: Document,
httpClient: HttpClient) {
super(titleService, renderer);
super(titleService, doc);
this.newsService = new PacifistaNewsService(httpClient, environment.production);

this.pageOption.elemsPerPage = 10;
Expand Down
8 changes: 4 additions & 4 deletions src/app/pages/news/news-page/news-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Inject, PLATFORM_ID, Renderer2} from '@angular/core';
import {Component, Inject, PLATFORM_ID} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import NotificationService from "../../../services/notifications/services/NotificationService";
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
Expand All @@ -12,7 +12,7 @@ import {
} from "@funixproductions/funixproductions-requests";
import {HttpClient} from "@angular/common/http";
import {environment} from "../../../../environments/environment";
import {isPlatformBrowser} from "@angular/common";
import {DOCUMENT, isPlatformBrowser} from "@angular/common";

@Component({
selector: 'app-news-page',
Expand All @@ -34,8 +34,8 @@ export class NewsPageComponent extends PacifistaPage {
@Inject(PLATFORM_ID) private platfomId: Object,
httpClient: HttpClient,
titleService: Title,
renderer: Renderer2) {
super(titleService, renderer);
@Inject(DOCUMENT) doc: Document) {
super(titleService, doc);
this.newsService = new PacifistaNewsService(httpClient, environment.production);

if (!isPlatformBrowser(this.platfomId)) return;
Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/shop/shop-checkout/shop-checkout.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {Title} from "@angular/platform-browser";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-shop-checkout',
Expand All @@ -14,8 +15,8 @@ export class ShopCheckoutComponent extends PacifistaPage {
protected override readonly pageDescription: string = "Boutique de Pacifista. Soutenez le serveur minecraft avec des avantages uniques !";

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
7 changes: 4 additions & 3 deletions src/app/pages/shop/shop.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {PacifistaPage} from "../../components/pacifista-page/pacifista-page";
import {Title} from "@angular/platform-browser";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-shop',
Expand All @@ -14,8 +15,8 @@ export class ShopComponent extends PacifistaPage {
protected override readonly pageDescription: string = "Boutique de Pacifista. Soutenez le serveur minecraft avec des avantages uniques !";

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {Title} from "@angular/platform-browser";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-user-forgot-password',
Expand All @@ -16,8 +17,8 @@ export class UserForgotPasswordComponent extends PacifistaPage {
email: string = '';

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

sendRequestReset() {
Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/user/user-login/user-login.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {ReCaptchaV3Service} from "ng-recaptcha";
import {Router} from "@angular/router";
import NotificationService from "../../../services/notifications/services/NotificationService";
Expand All @@ -12,6 +12,7 @@ import {Title} from "@angular/platform-browser";
import {HttpClient} from "@angular/common/http";
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {environment} from "../../../../environments/environment";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-user-login',
Expand All @@ -34,9 +35,9 @@ export class UserLoginComponent extends PacifistaPage {
private router: Router,
private notificationService: NotificationService,
titleService: Title,
renderer: Renderer2,
@Inject(DOCUMENT) doc: Document,
httpClient: HttpClient) {
super(titleService, renderer);
super(titleService, doc);
this.userAuthService = new UserAuthService(httpClient, environment.production);
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/pages/user/user-page/user-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Component, Inject, PLATFORM_ID, Renderer2} from '@angular/core';
import {Component, Inject, PLATFORM_ID} from '@angular/core';
import {Router} from "@angular/router";
import {faSearch} from '@fortawesome/free-solid-svg-icons';
import {PacifistaPage} from "../../../components/pacifista-page/pacifista-page";
import {UserAuthService, UserDTO} from "@funixproductions/funixproductions-requests";
import {Title} from "@angular/platform-browser";
import {environment} from "../../../../environments/environment";
import {HttpClient} from "@angular/common/http";
import {isPlatformBrowser} from "@angular/common";
import {DOCUMENT, isPlatformBrowser} from "@angular/common";

@Component({
selector: 'app-user-page',
Expand All @@ -27,9 +27,9 @@ export class UserPageComponent extends PacifistaPage {
constructor(private router: Router,
@Inject(PLATFORM_ID) private platfomId: Object,
title: Title,
renderer: Renderer2,
@Inject(DOCUMENT) doc: Document,
httpClient: HttpClient) {
super(title, renderer);
super(title, doc);
this.authService = new UserAuthService(httpClient, environment.production);
}

Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/user/user-register/user-register.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {Router} from "@angular/router";
import {ReCaptchaV3Service} from "ng-recaptcha";
import {UserAuthService, UserCreationDTO} from "@funixproductions/funixproductions-requests";
Expand All @@ -7,6 +7,7 @@ import {Title} from "@angular/platform-browser";
import {HttpClient} from "@angular/common/http";
import {environment} from "../../../../environments/environment";
import NotificationService from "../../../services/notifications/services/NotificationService";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-user-register',
Expand All @@ -32,9 +33,9 @@ export class UserRegisterComponent extends PacifistaPage {
private router: Router,
private notificationService: NotificationService,
titleService: Title,
renderer: Renderer2,
@Inject(DOCUMENT) doc: Document,
httpClient: HttpClient) {
super(titleService, renderer);
super(titleService, doc);
this.userAuthService = new UserAuthService(httpClient, environment.production);
}

Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/vote/vote.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {Title} from "@angular/platform-browser";
import {PacifistaPage} from "../../components/pacifista-page/pacifista-page";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-vote-page',
Expand All @@ -14,8 +15,8 @@ export class VoteComponent extends PacifistaPage {
protected override readonly pageDescription: string = "Votez pour Pacifista et recevez des récompenses en jeu. Aidez-nous à faire connaître le serveur !";

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}
7 changes: 4 additions & 3 deletions src/app/pages/wiki/wiki.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Renderer2} from '@angular/core';
import {Component, Inject} from '@angular/core';
import {PacifistaPage} from "../../components/pacifista-page/pacifista-page";
import {Title} from "@angular/platform-browser";
import {DOCUMENT} from "@angular/common";

@Component({
selector: 'app-wiki',
Expand All @@ -14,8 +15,8 @@ export class WikiComponent extends PacifistaPage {
protected override readonly pageDescription: string = "Wiki de Pacifista. Retrouvez toutes les informations sur le serveur minecraft et comment jouer ! Claims, Créatif, Métiers, Jobs et bien plus !";

constructor(title: Title,
renderer: Renderer2) {
super(title, renderer);
@Inject(DOCUMENT) doc: Document) {
super(title, doc);
}

}

0 comments on commit 8aa8917

Please sign in to comment.