From 1ee0778e62b1cb3e751f75649ca91601cae15b74 Mon Sep 17 00:00:00 2001 From: leroy Date: Sat, 19 Apr 2025 17:12:52 +0200 Subject: [PATCH] V1.1 --- public/.htaccess | 6 ++ public/robots.txt | 4 + public/sitemap.xml | 32 +++++++ .../_component/sidbar/sidbar.component.css | 0 .../_component/sidbar/sidbar.component.html | 91 ------------------- src/app/_component/sidbar/sidbar.component.ts | 63 ------------- src/app/_models/seo.ts | 8 ++ src/app/_models/users.ts | 9 -- src/app/_models/video.ts | 13 --- src/app/_services/seo.service.ts | 43 +++++++++ .../pages/experience/experience.component.ts | 17 +++- .../pages/formations/formations.component.ts | 17 +++- src/app/public/pages/home/home.component.ts | 17 +++- .../public/pages/projets/projets.component.ts | 17 +++- 14 files changed, 153 insertions(+), 184 deletions(-) create mode 100644 public/.htaccess create mode 100644 public/robots.txt create mode 100644 public/sitemap.xml delete mode 100644 src/app/_component/sidbar/sidbar.component.css delete mode 100644 src/app/_component/sidbar/sidbar.component.html delete mode 100644 src/app/_component/sidbar/sidbar.component.ts create mode 100644 src/app/_models/seo.ts delete mode 100644 src/app/_models/users.ts delete mode 100644 src/app/_models/video.ts create mode 100644 src/app/_services/seo.service.ts diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..89f09d6 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,6 @@ +RewriteEngine On +RewriteBase / + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ /index.html [L] diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..f7ac9bc --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / +Disallow: /*?* +Sitemap: https://johanleroy.fr/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..262292a --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,32 @@ + + + + + https://johanleroy.fr + 2025-04-19 + weekly + 1.0 + + + + https://johanleroy.fr/formations + 2025-04-19 + monthly + 0.9 + + + + https://techos-asso.fr/experience + 2025-04-19 + monthly + 0.9 + + + + https://techos-asso.fr/projets + 2025-04-19 + monthly + 0.9 + + + diff --git a/src/app/_component/sidbar/sidbar.component.css b/src/app/_component/sidbar/sidbar.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/_component/sidbar/sidbar.component.html b/src/app/_component/sidbar/sidbar.component.html deleted file mode 100644 index fa9b2b7..0000000 --- a/src/app/_component/sidbar/sidbar.component.html +++ /dev/null @@ -1,91 +0,0 @@ -
-
-
- YouVideo -
-
- -
diff --git a/src/app/_component/sidbar/sidbar.component.ts b/src/app/_component/sidbar/sidbar.component.ts deleted file mode 100644 index 86286c0..0000000 --- a/src/app/_component/sidbar/sidbar.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import {Component, OnInit} from '@angular/core'; -import {AuthService} from '../../_services/auth.service'; -import {Users} from '../../_models/users'; -import {catchError, of} from 'rxjs'; -import {NgIf} from '@angular/common'; -import {Router, RouterLink} from '@angular/router'; - -@Component({ - selector: 'app-sidbar', - imports: [ - NgIf, - RouterLink - ], - templateUrl: './sidbar.component.html', - styleUrl: './sidbar.component.css' -}) -export class SidbarComponent implements OnInit { - - user: Users = { id: 0, email: '', firstname: '', lastname: '', password_hash: '', updated_at: new Date(), created_at: new Date() }; - - constructor(private authService: AuthService, private router: Router) {} - - ngOnInit(): void { - this.checkAuthAndLoadUser(); - - } - - checkAuthAndLoadUser(): void { - this.authService.isAuthenticated().subscribe(isAuthenticated => { - if (isAuthenticated) { - this.loadUsers(); - } else { - this.user = { id: 0, email: '', firstname: '', lastname: '', password_hash: '', updated_at: new Date(), created_at: new Date() }; - } - }); - } - - loadUsers(): void { - this.authService.getProfil().pipe( - catchError(error => { - console.error('Erreur lors du chargement du profil:', error); - return of(null); - }) - ).subscribe(users => { - if (users) { - console.log(users); - this.user = users; - } - }); - } - - logout(): void { - this.authService.logout().subscribe({ - next: () => { - this.router.navigate(['/']); - }, - error: (err) => { - console.error('Logout failed:', err); - } - }); - } - -} diff --git a/src/app/_models/seo.ts b/src/app/_models/seo.ts new file mode 100644 index 0000000..ee7564d --- /dev/null +++ b/src/app/_models/seo.ts @@ -0,0 +1,8 @@ +export interface SEOConfig { + title: string; + description: string; + keywords?: string; + ogTitle?: string; + ogDescription?: string; + ogImage?: string; +} diff --git a/src/app/_models/users.ts b/src/app/_models/users.ts deleted file mode 100644 index 967cbbc..0000000 --- a/src/app/_models/users.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface Users { - id: number; - email: string; - firstname: string; - lastname: string; - password_hash: string; - updated_at: Date; - created_at: Date; -} diff --git a/src/app/_models/video.ts b/src/app/_models/video.ts deleted file mode 100644 index 33e8e26..0000000 --- a/src/app/_models/video.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface Videos { - data: Video[]; -} -export interface Video { - id: number; - user_id: number; - name: string; - description: string; - link_miniature: string; - link_video: string; - created_at: Date; - updated_at: Date; -} diff --git a/src/app/_services/seo.service.ts b/src/app/_services/seo.service.ts new file mode 100644 index 0000000..3f8d4d7 --- /dev/null +++ b/src/app/_services/seo.service.ts @@ -0,0 +1,43 @@ +import {inject, Injectable} from '@angular/core'; +import {Meta, Title} from '@angular/platform-browser'; +import {SEOConfig} from '../_models/seo'; + +@Injectable({ + providedIn: 'root' +}) +export class SeoService { + + private meta = inject(Meta); + private title = inject(Title); + + updateSEOMetaTags(config: SEOConfig) { + // Mise à jour du titre + this.title.setTitle(config.title); + + // Mise à jour des meta tags standards + this.meta.updateTag({ name: 'description', content: config.description }); + if (config.keywords) { + this.meta.updateTag({ name: 'keywords', content: config.keywords }); + } + + // Mise à jour des meta tags Open Graph + this.meta.updateTag({ property: 'og:title', content: config.ogTitle || config.title }); + this.meta.updateTag({ property: 'og:description', content: config.ogDescription || config.description }); + if (config.ogImage) { + this.meta.updateTag({ property: 'og:image', content: config.ogImage }); + } + + // Autres meta tags importants + this.meta.updateTag({ name: 'robots', content: 'index,follow' }); + this.meta.updateTag({ name: 'viewport', content: 'width=device-width, initial-scale=1' }); + } + + createCanonicalLink(url?: string) { + const canURL = url || document.URL; + const link: HTMLLinkElement = document.createElement('link'); + link.setAttribute('rel', 'canonical'); + link.setAttribute('href', canURL); + document.head.appendChild(link); + } + +} diff --git a/src/app/public/pages/experience/experience.component.ts b/src/app/public/pages/experience/experience.component.ts index fb0721d..f6ef8a3 100644 --- a/src/app/public/pages/experience/experience.component.ts +++ b/src/app/public/pages/experience/experience.component.ts @@ -1,4 +1,5 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {SeoService} from '../../../_services/seo.service'; @Component({ selector: 'app-experience', @@ -6,6 +7,18 @@ import { Component } from '@angular/core'; templateUrl: './experience.component.html', styleUrl: './experience.component.css' }) -export class ExperienceComponent { +export class ExperienceComponent implements OnInit { + + constructor(private seoService: SeoService) { } + + ngOnInit(): void { + this.seoService.updateSEOMetaTags({ + title: 'Mes expériences - Portfolio', + description: 'Découvrez mes expériences', + keywords: 'johanleroy, johan, leroy, développeur, portfolio, johan leroy développeur, johan leroy portfolio, johan leroy dev web, johan leroy angular, johan leroy express, développeur web, développeur Angular, développeur Express.js, développeur fullstack, développeur JavaScript, développeur TypeScript, développeur Node.js, développeur REST API, développeur tailwind css, développeur MariaDB, développeur SQL, créer un site web, développeur freelance, portfolio développeur web, expert Angular, développeur application web, intégrateur tailwind, développeur web, freelance développeur\n', + ogImage: 'https://johanleroy.fr/favicon.ico' + }); + this.seoService.createCanonicalLink(); + } } diff --git a/src/app/public/pages/formations/formations.component.ts b/src/app/public/pages/formations/formations.component.ts index 2e5894d..aa35131 100644 --- a/src/app/public/pages/formations/formations.component.ts +++ b/src/app/public/pages/formations/formations.component.ts @@ -1,4 +1,5 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {SeoService} from '../../../_services/seo.service'; @Component({ selector: 'app-formations', @@ -6,6 +7,18 @@ import { Component } from '@angular/core'; templateUrl: './formations.component.html', styleUrl: './formations.component.css' }) -export class FormationsComponent { +export class FormationsComponent implements OnInit { + + constructor(private seoService: SeoService) { } + + ngOnInit(): void { + this.seoService.updateSEOMetaTags({ + title: 'Mes formations - Portfolio', + description: 'Découvrez mes formations', + keywords: 'johanleroy, johan, leroy, développeur, portfolio, johan leroy développeur, johan leroy portfolio, johan leroy dev web, johan leroy angular, johan leroy express, développeur web, développeur Angular, développeur Express.js, développeur fullstack, développeur JavaScript, développeur TypeScript, développeur Node.js, développeur REST API, développeur tailwind css, développeur MariaDB, développeur SQL, créer un site web, développeur freelance, portfolio développeur web, expert Angular, développeur application web, intégrateur tailwind, développeur web, freelance développeur\n', + ogImage: 'https://johanleroy.fr/favicon.ico' + }); + this.seoService.createCanonicalLink(); + } } diff --git a/src/app/public/pages/home/home.component.ts b/src/app/public/pages/home/home.component.ts index 3cb17db..ef26450 100644 --- a/src/app/public/pages/home/home.component.ts +++ b/src/app/public/pages/home/home.component.ts @@ -1,5 +1,6 @@ -import {Component} from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {RouterLink} from '@angular/router'; +import {SeoService} from '../../../_services/seo.service'; @Component({ selector: 'app-home', @@ -9,6 +10,18 @@ import {RouterLink} from '@angular/router'; templateUrl: './home.component.html', styleUrl: './home.component.css' }) -export class HomeComponent { +export class HomeComponent implements OnInit { + + constructor(private seoService: SeoService) { } + + ngOnInit(): void { + this.seoService.updateSEOMetaTags({ + title: 'Johan Leroy - Portfolio', + description: 'Découvrez mon portfolio', + keywords: 'johanleroy, johan, leroy, développeur, portfolio, johan leroy développeur, johan leroy portfolio, johan leroy dev web, johan leroy angular, johan leroy express, développeur web, développeur Angular, développeur Express.js, développeur fullstack, développeur JavaScript, développeur TypeScript, développeur Node.js, développeur REST API, développeur tailwind css, développeur MariaDB, développeur SQL, créer un site web, développeur freelance, portfolio développeur web, expert Angular, développeur application web, intégrateur tailwind, développeur web, freelance développeur\n', + ogImage: 'https://johanleroy.fr/favicon.ico' + }); + this.seoService.createCanonicalLink(); + } } diff --git a/src/app/public/pages/projets/projets.component.ts b/src/app/public/pages/projets/projets.component.ts index ef5ace5..25715af 100644 --- a/src/app/public/pages/projets/projets.component.ts +++ b/src/app/public/pages/projets/projets.component.ts @@ -1,4 +1,5 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {SeoService} from '../../../_services/seo.service'; @Component({ selector: 'app-projets', @@ -6,6 +7,18 @@ import { Component } from '@angular/core'; templateUrl: './projets.component.html', styleUrl: './projets.component.css' }) -export class ProjetsComponent { +export class ProjetsComponent implements OnInit { + + constructor(private seoService: SeoService) { } + + ngOnInit(): void { + this.seoService.updateSEOMetaTags({ + title: 'Mes projets - Portfolio', + description: 'Découvrez mes projets', + keywords: 'johanleroy, johan, leroy, développeur, portfolio, johan leroy développeur, johan leroy portfolio, johan leroy dev web, johan leroy angular, johan leroy express, développeur web, développeur Angular, développeur Express.js, développeur fullstack, développeur JavaScript, développeur TypeScript, développeur Node.js, développeur REST API, développeur tailwind css, développeur MariaDB, développeur SQL, créer un site web, développeur freelance, portfolio développeur web, expert Angular, développeur application web, intégrateur tailwind, développeur web, freelance développeur\n', + ogImage: 'https://johanleroy.fr/favicon.ico' + }); + this.seoService.createCanonicalLink(); + } }