Skip to content

Commit

Permalink
feat(404 pages): 404 page and some seo works were done
Browse files Browse the repository at this point in the history
  • Loading branch information
muharsln committed Nov 1, 2024
1 parent edfc37c commit 935b266
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 47 deletions.
12 changes: 8 additions & 4 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# HTTP'den HTTPS'e yönlendirme
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# 404 hatasında ana sayfaya yönlendirme
ErrorDocument 404 /index.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Expand All @@ -8,9 +16,5 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Yönlendirme: Bulunamadığında /about sayfasına git
# RewriteRule . /about [R=302,L]

# Alternatif olarak, burada index.html'ye yönlendirmeyi de ekleyebilirsiniz
RewriteRule . /index.html [L]
</IfModule>
16 changes: 8 additions & 8 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<priority>1.0</priority>
</url>
<url>
<loc>https://muhammedarslan.net/resume</loc>
<lastmod>2024-10-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
<loc>https://muhammedarslan.net/blog</loc>
<lastmod>2024-10-12</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://muhammedarslan.net/portfolio</loc>
Expand All @@ -24,9 +24,9 @@
<priority>0.8</priority>
</url>
<url>
<loc>https://muhammedarslan.net/blog</loc>
<lastmod>2024-10-12</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
<loc>https://muhammedarslan.net/resume</loc>
<lastmod>2024-10-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
</urlset>
41 changes: 37 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { Component, OnInit, Renderer2 } from '@angular/core';
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
import { SidebarComponent } from "./components/sidebar/sidebar.component";
import { NavbarComponent } from "./components/navbar/navbar.component";
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { Meta } from '@angular/platform-browser';
import { filter } from 'rxjs/operators';

@Component({
selector: 'app-root',
Expand All @@ -11,8 +13,13 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
constructor(private translate: TranslateService) {
export class AppComponent implements OnInit {
constructor(
private translate: TranslateService,
private router: Router,
private metaService: Meta,
private renderer: Renderer2
) {
const supportedLanguages = ['en', 'tr'];

// Tarayıcı dilini alırken undefined olma durumunu kontrol edin
Expand All @@ -22,6 +29,32 @@ export class AppComponent {
// Varsayılan dili ayarla
this.translate.setDefaultLang(defaultLang);
this.translate.use(defaultLang);

// Tarayıcı diline göre <html> etiketinin lang özniteliğini ayarla
this.renderer.setAttribute(document.documentElement, 'lang', defaultLang);
}

ngOnInit(): void {
this.router.events
.pipe(filter(event => event instanceof NavigationEnd))
.subscribe(() => {
const currentRoute = this.router.routerState.snapshot.root.firstChild;
const canonicalURL = `https://muhammedarslan.net${this.router.url}`;
this.updateCanonicalURL(canonicalURL);

if (currentRoute && currentRoute.data) {
this.updateMetaTags(currentRoute.data);
}
});
}
// Meta etiketler içerisinde yer alan ve seo açısından önemli olan canonical'ın linkini açılan sayfaya göre günceller
updateCanonicalURL(url: string) {
this.metaService.updateTag({ rel: 'canonical', href: url }, `link[rel='canonical']`);
}

// Meta etiketlerinden description tagını generic olarak günceller
updateMetaTags(data: any) {
this.metaService.updateTag({ name: 'description', content: data.description });
}

}
32 changes: 26 additions & 6 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
import { Routes } from '@angular/router';

import { AboutComponent } from './components/about/about.component';
import { PageNotFoundComponent } from './components/page-not-found/page-not-found.component';

export const routes: Routes = [
{
path: '',
component: AboutComponent
{
path: '',
component: AboutComponent,
data: {
description: 'Kişisel sayfamda hakkımda bilgi edinebilir, yaptığım projeleri görebilir ve yazdığım makaleleri okuyabilirsiniz.'
}
},
{
path: 'resume',
loadComponent: () => import('./components/resume/resume.component').then(m => m.ResumeComponent)
loadComponent: () => import('./components/resume/resume.component').then(m => m.ResumeComponent),
data: {
description: 'Bu sayfada öz geçmişimi görüntüleyebilir, deneyim ve eğitimlerimi inceleyebilirsiniz.'
}
},
{
path: 'portfolio',
loadComponent: () => import('./components/portfolio/portfolio.component').then(m => m.PortfolioComponent)
loadComponent: () => import('./components/portfolio/portfolio.component').then(m => m.PortfolioComponent),
data: {
description: 'Bu sayfada yapmış olduğum projeleri görüntüleyebilir, dilerseniz kodlarımı inceleyebilirsiniz.'
}
},
{
path: 'blog',
loadComponent: () => import('./components/blog/blog.component').then(m => m.BlogComponent)
loadComponent: () => import('./components/blog/blog.component').then(m => m.BlogComponent),
data: {
description: 'Bu sayfada yazmış olduğum blog yazılarımı görüntüleyip, dilediğinizi okuyabilirsiniz.'
}
},
{
path: '**',
component: PageNotFoundComponent,
data: {
description: 'Maalesef erişmek istediğiniz sayfa bulunmamaktadır.'
}
}
];
26 changes: 7 additions & 19 deletions src/app/components/about/about.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<article class="about">

<header>
<h2 class="h2 article-title"> {{"ABOUT"|translate}}</h2>
<h1 class="h2 article-title">{{"ABOUT"|translate}}</h1>
</header>

<section class="about-text">
Expand All @@ -10,50 +10,38 @@ <h2 class="h2 article-title"> {{"ABOUT"|translate}}</h2>

<!-- service -->
<section class="service">

<h3 class="h3 service-title">{{"WHAT I'M DOING" | translate}}</h3>
<h2 class="h3 service-title">{{"WHAT I'M DOING" | translate}}</h2>

<ul class="service-list">

<li class="service-item">

<div class="service-icon-box">
<img src="./assets/images/icon-design.svg" alt="design icon" width="40">
</div>

<div class="service-content-box">
<h4 class="h4 service-item-title">{{"BACKEND"|translate}}</h4>

<h3 class="h4 service-item-title">{{"BACKEND"|translate}}</h3>
<p class="service-item-text">{{"BACKEND TEXT"|translate}}</p>
</div>

</li>

<li class="service-item">

<div class="service-icon-box">
<img src="./assets/images/icon-dev.svg" alt="Web development icon" width="40">
</div>

<div class="service-content-box">
<h4 class="h4 service-item-title">{{"FRONTEND"|translate}}</h4>

<h3 class="h4 service-item-title">{{"FRONTEND"|translate}}</h3>
<p class="service-item-text">{{"FRONTEND TEXT"|translate}}</p>
</div>

</li>

</ul>

</section>

<!-- skill -->
<section class="skill">
<h3 class="h3 skills-title">{{"MY SKILLS"|translate}}</h3>
<h2 class="h3 skills-title">{{"MY SKILLS"|translate}}</h2>
<div class="skills-list">
<div *ngFor="let skill of skills" class="skills-item">
<h5 class="h5">{{skill}}</h5>
<h3 class="h5">{{skill}}</h3>
</div>
</div>
</section>

</article>
5 changes: 0 additions & 5 deletions src/app/components/blog/blog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ <h2 class="h2 article-title">Blog</h2>
</div>

<h3 class="h3 blog-item-title">{{post.title}}</h3>

<p class="blog-text">
Veritatis et quasi architecto beatae vitae dicta sunt, explicabo.
</p>

</div>
</a>
</li>
Expand Down
38 changes: 38 additions & 0 deletions src/app/components/page-not-found/page-not-found.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* .not-found {
position: relative;
} */

.error-message-container {
display: flex;
justify-content: center;
align-items: center;
height: 60vh;
}

.error-message {
text-align: center;
}

h1 {
font-size: 5rem;
color: var(--orange-yellow-crayola);
}

p {
font-size: 1.5rem;
margin: 1rem 0;
color: white;
}

.go-back {
display: inline-block;
padding: 10px 20px;
background-color: #3498db;
color: white;
text-decoration: none;
border-radius: 5px;
}

.go-back:hover {
background-color: #2980b9;
}
13 changes: 13 additions & 0 deletions src/app/components/page-not-found/page-not-found.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<article class="not-found">
<header>
<h2 class="h2 article-title">Sayfa Bulunamadı</h2>
</header>

<div class="error-message-container">
<div class="error-message">
<h1>404</h1>
<p>Sayfa Bulunamadı</p>
<a routerLink='/' class="go-back">Geri Dön</a>
</div>
</div>
</article>
13 changes: 13 additions & 0 deletions src/app/components/page-not-found/page-not-found.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';

@Component({
selector: 'app-page-not-found',
standalone: true,
imports: [RouterLink],
templateUrl: './page-not-found.component.html',
styleUrl: './page-not-found.component.css'
})
export class PageNotFoundComponent {

}
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="icon" type="image/png" href="favicon.png" sizes="48x48"/>

<!-- SEO Meta Tags -->
<meta name="description" content="You can learn about me, see the projects I have done and read the articles I have written on my personal page.">
<meta name="description" content="">
<meta name="keywords" content="Muhammed Arslan, Software Developer, Backend Developer, Cv, Blog">
<meta name="author" content="Muhammed Arslan">

Expand Down

0 comments on commit 935b266

Please sign in to comment.