Skip to content

Commit

Permalink
seo tags
Browse files Browse the repository at this point in the history
  • Loading branch information
RiddleTime committed Jun 19, 2024
1 parent 0e536be commit 4cb7de1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<!-- seo start -->
<meta name="author" content="RiddleTime" />
<meta property="og:locale" content="en_US" />
<meta property="og:title" content="Race Element" />
<!-- <meta property="og:title" content="Race Element" /> -->
<meta name="description" content="Solutions for Sim Racing" />
<meta property="og:description" content="Solutions for Sim Racing" />
<!-- <meta property="og:description" content="Solutions for Sim Racing" /> -->
<meta property="og:image" content="https://github.com/RiddleTime/Race-Element/blob/dev/other%20resources/race%20element%20icon%202.png" />
<meta property="og:url" content="https://race.elementfuture.com/" />
<meta property="og:site_name" content="Race Element" />
Expand Down
18 changes: 16 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { SocialsComponent } from "./components/socials/socials.component";
import { RouteMeta } from '@analogjs/router';


export const routeMeta: RouteMeta = {
meta: [
{
property: 'og:title',
content: 'Race Element',
},
{
property: 'og:description',
content: 'Solutions for Sim Racing',
},
],
};

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -45,6 +60,5 @@ import { SocialsComponent } from "./components/socials/socials.component";
imports: [RouterOutlet, SocialsComponent]
})
export class AppComponent {
ThisYear:number = new Date().getFullYear();

ThisYear: number = new Date().getFullYear();
}
13 changes: 5 additions & 8 deletions src/app/pages/guide/[slug].page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ export default class GuideSlugComponent implements OnInit {

ngOnInit(): void {
this.post.forEach(x => {
this.meta.removeTag("og:url");
this.meta.removeTag("og:title");
this.meta.removeTag("og:description");
this.meta.removeTag("twitter:title");
this.meta.addTag({ name: 'og:url', content: `https://race.elementfuture.com/guide/${x.attributes.slug}` })
this.meta.addTag({ name: 'og:title', content: `Race Element - Guide | ${x.attributes.title}` })
this.meta.addTag({ name: 'og:description', content: `${x.attributes.description}` })
this.meta.addTag({ name: 'twitter:title', content: `Race Element - Guide | ${x.attributes.title}` })
console.log(x);
this.meta.updateTag({ name: `og:url`, content: `https://race.elementfuture.com/guide/${x.attributes.slug}` })
this.meta.updateTag({ name: `og:title`, content: `Race Element - Guide | ${x.attributes.title}` })
this.meta.updateTag({ name: `og:description`, content: `${x.attributes.description}` })
this.meta.updateTag({ name: `twitter:title`, content: `Race Element - Guide | ${x.attributes.title}` })
});
}
}
12 changes: 4 additions & 8 deletions src/app/pages/news/[slug].page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ export default class NewsSlugComponent implements OnInit{

ngOnInit(): void {
this.post.forEach(x => {
this.meta.removeTag("og:url");
this.meta.removeTag("og:title");
this.meta.removeTag("og:description");
this.meta.removeTag("twitter:title");
this.meta.addTag({ name: 'og:url', content: `https://race.elementfuture.com/news/${x.attributes.slug}` })
this.meta.addTag({ name: 'og:title', content: `Race Element - News | ${x.attributes.title}` })
this.meta.addTag({ name: 'og:description', content: `${x.attributes.description}` })
this.meta.addTag({ name: 'twitter:title', content: `Race Element - News | ${x.attributes.title}` })
this.meta.updateTag({ name: `og:url`, content: `https://race.elementfuture.com/news/${x.attributes.slug}` });
this.meta.updateTag({ name: `og:title`, content: `Race Element - News | ${x.attributes.title}` });
this.meta.updateTag({ name: `og:description`, content: `${x.attributes.description}` });
this.meta.updateTag({ name: `twitter:title`, content: `Race Element - News | ${x.attributes.title}` });
});
}
}
2 changes: 1 addition & 1 deletion src/app/pages/news/index.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const routeMeta: RouteMeta = {
{
property: 'og:title',
content: 'Race Element - News',
},
}
],
};

Expand Down

0 comments on commit 4cb7de1

Please sign in to comment.