diff --git a/public/i18n/de.json b/public/i18n/de.json
index 0c39f7e..6e4caee 100644
--- a/public/i18n/de.json
+++ b/public/i18n/de.json
@@ -18,10 +18,22 @@
"BLOG_SUB": "(Sehr) irreguläre updates",
- "ARTICLE_BACK": "Zurück zur Übersicht",
"ARTICLES_NONE": "Noch keine Artikel!",
"ARTICLE_NOTFOUND": "Artikel wurde nicht gefunden!",
- "CREATED_AT": "Erstellt:",
+
+ "TIME": {
+ "FORMAT": "H:mm",
+ "PREFIX": "um ",
+ "SUFFIX": " Uhr"
+ },
+
+ "BUTTONS": {
+ "SHARE": "Teilen",
+ "BACK": "Zurück"
+ },
+
+ "RELEASED_AT": "Publikationsdatum",
+ "UPDATED_AT": "Letzte Änderung",
"IMP_TITLE": "Impressum",
"IMPRINT": "Diese Website wird betrieben von Michael Reisinger in Österreich, erreichbar unter:",
diff --git a/public/i18n/en.json b/public/i18n/en.json
index e46c0ab..6bbb41b 100644
--- a/public/i18n/en.json
+++ b/public/i18n/en.json
@@ -19,10 +19,22 @@
"BLOG_SUB": "Some (very) irregular updates",
- "ARTICLE_BACK": "Back to Overview",
"ARTICLES_NONE": "No Articles yet!",
"ARTICLE_NOTFOUND": "Article not found!",
- "CREATED_AT": "Created At:",
+
+ "TIME": {
+ "FORMAT": "shortTime",
+ "PREFIX": "at ",
+ "SUFFIX": ""
+ },
+
+ "BUTTONS": {
+ "SHARE": "Share",
+ "BACK": "Back"
+ },
+
+ "RELEASED_AT": "Publishing Date",
+ "UPDATED_AT": "Last Update",
"privacy": {
"title": "Privacy Policy",
diff --git a/src/app/about/about.component.ts b/src/app/about/about.component.ts
index 9202d75..0b3183b 100644
--- a/src/app/about/about.component.ts
+++ b/src/app/about/about.component.ts
@@ -44,10 +44,10 @@ export class AboutComponent implements OnInit, AfterViewInit {
desc: 'Welcome to itzMiney\'s Homepage! Here you can find my portfolio and other cool stuff.',
suffix: false,
buttons: [
- { label: 'About', url: 'https://itzminey.dev/about' },
- { label: 'Portfolio', url: 'https://itzminey.dev/portfolio' },
- { label: 'Socials', url: 'https://itzminey.dev/socials' },
- { label: 'Blog', url: 'https://itzminey.dev/blog' }
+ { label: 'About', url: this.seo.getpath('root') },
+ { label: 'Portfolio', url: this.seo.getpath('portfolio') },
+ { label: 'Socials', url: this.seo.getpath('socials') },
+ { label: 'Blog', url: this.seo.getpath('blog') }
]
});
this.isNarrow = this.deviceService.isNarrow;
diff --git a/src/app/admin/admin.component.ts b/src/app/admin/admin.component.ts
index d5ea07e..1d5d51f 100644
--- a/src/app/admin/admin.component.ts
+++ b/src/app/admin/admin.component.ts
@@ -97,7 +97,8 @@ export class AdminComponent implements OnInit, OnDestroy {
ngOnInit() {
this.seo.update({
title: 'Admin Panel',
- desc: 'Management & Administration Panel'
+ desc: 'Management & Administration Panel',
+ buttons: [{ label: 'Log-in', url: this.seo.getpath('root')}]
});
this.isNarrow = this.deviceService.isNarrow;
diff --git a/src/app/blog/article-page/article-page.component.css b/src/app/blog/article-page/article-page.component.css
index 88b4508..4e0f20d 100644
--- a/src/app/blog/article-page/article-page.component.css
+++ b/src/app/blog/article-page/article-page.component.css
@@ -111,60 +111,98 @@ h1 {
}
.article-meta {
- font-size: 1rem;
- color: #D6DAEFBD;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ font-size: 0.95rem;
+ color: rgb(168 168 211);
text-align: left;
- margin: 25px 0;
+ margin: 0;
+}
+
+.article-meta strong, .article-meta .meta-left i {
+ color: rgb(214 217 255);
+}
+
+.article-meta p {
+ margin: 0;
+}
+
+.article-meta .meta-right strong {
+ font-size: 0.8rem;
+}
+
+.article-meta .meta-left, .article-meta .meta-right {
+ display: flex;
+ flex-direction: column;
+ gap: 0.2rem;
}
.article-buttons {
display: flex;
+ flex-direction: row;
align-items: center;
+ color: white;
+ justify-content: space-between;
+ margin: 0 0 5px 15px;
}
-.article-buttons button {
- background-color: #444893FF;
- color: #fff;
- border: none;
- padding: 10px 20px;
- font-size: 1rem;
- cursor: pointer;
- border-radius: 25px;
- transition: background-color 0.3s;
- font-weight: 400;
-}
-
-.article-buttons button:hover {
- background-color: #707ec5;
-}
-
-#shareBtn {
- background-color: transparent;
+.article-buttons i {
font-size: 1.5rem;
+}
+
+.article-buttons .buttons-left {
+ display: inline-flex;
+ gap: 20px;
+ margin-bottom: 10px;
+ cursor: pointer;
+}
+
+.article-buttons .buttons-right {
+ display: inline-flex;
+ margin-top: auto;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.article-buttons .buttons-right i {
+ font-size: 1rem;
+}
+
+.article-buttons .buttons-right p {
+ margin: 0;
+ font-size: 0.8rem;
+}
+
+.article-buttons a {
+ background-color: transparent;
+ border: none;
+ color: white;
margin: 0;
transition: all ease-in-out 0.2s;
}
-#shareBtn:hover {
- color: #cfd7f8;
+.article-buttons #shareBtn:hover {
+ color: #b9ecff;
}
-#shareBtn.copied {
- color: #8798dc;
+.article-buttons #shareBtn:focus, #shareBtn.copied {
+ color: #5ee0ff;
}
-.back-btn {
- display: flex;
- width: 100%;
- margin-right: 64px;
- justify-content: center;
+.article-buttons #backBtn:hover {
+ color: #ffb2b6;
+}
+
+.article-buttons #backBtn:focus {
+ color: #c62d46;
}
.error-message h1 {
font-size: 10rem;
margin: 0;
font-weight: 700;
- color: white;
+ color: #ffd0d0;
}
.error-message p {
diff --git a/src/app/blog/article-page/article-page.component.html b/src/app/blog/article-page/article-page.component.html
index e24a224..272a61a 100644
--- a/src/app/blog/article-page/article-page.component.html
+++ b/src/app/blog/article-page/article-page.component.html
@@ -17,9 +17,8 @@
{{ article.title }}
@@ -31,15 +30,31 @@
(click)="onArticleContentClick($event)"
>
-
-
-
Author: {{ article.authorName}}
-
Views: {{ article.views }}
-
{{ 'CREATED_AT' | translate }} {{ article.createdAt | date:'MMM dd, yyyy, HH:mm' }}
+
+
diff --git a/src/app/blog/article-page/article-page.component.ts b/src/app/blog/article-page/article-page.component.ts
index 8245d72..437362d 100644
--- a/src/app/blog/article-page/article-page.component.ts
+++ b/src/app/blog/article-page/article-page.component.ts
@@ -45,10 +45,8 @@ export class ArticlePageComponent implements OnInit {
loading: boolean = true;
renderedContent: string = '';
-
- readonly defaultThumbUrl = '/assets/ogimg.png';
-
isNarrow: boolean = false;
+ defaultThumbUrl: string = '';
constructor(
private articleService: ArticleService,
@@ -62,6 +60,8 @@ export class ArticlePageComponent implements OnInit {
this.route.params.subscribe((params) => {
const slug = params['slug'];
+ this.defaultThumbUrl = this.seo.getpath('assets/ogimg.png');
+
this.loading = true;
this.error = false;
this.article = null;
@@ -93,10 +93,18 @@ export class ArticlePageComponent implements OnInit {
this.renderedContent = this.transformCustomBlocks(article.content);
this.loading = false;
+ const thumbUrl = article.thumb_url || this.defaultThumbUrl;
+
this.seo.update({
title: article.title,
- desc: article.content.substring(0, 150).replace(/[#*`_]/g, '') + '...', // Clean excerpt for description
- img: article.thumb_url || undefined
+ desc: article.content.substring(0, 150).replace(/[#*`_]/g, '') + '...',
+ gallery: [{
+ url: thumbUrl
+ }],
+ buttons: [
+ { label: 'Read Post', url: this.seo.getpath() },
+ { label: 'View All', url: this.seo.getpath('blog') }
+ ]
});
},
error: (error) => {
@@ -117,14 +125,6 @@ export class ArticlePageComponent implements OnInit {
});
}
- onThumbError(event: Event): void {
- const img = event.target as HTMLImageElement;
-
- if (img.src.endsWith(this.defaultThumbUrl)) return;
-
- img.src = this.defaultThumbUrl;
- }
-
onArticleContentClick(event: MouseEvent) {
const target = event.target as HTMLElement;
@@ -171,15 +171,33 @@ export class ArticlePageComponent implements OnInit {
this.selectedImage = null;
}
- copyLink() {
- const slug = this.route.snapshot.paramMap.get('slug') || '';
- const shareLink: string = 'https://itzminey.dev/blog/' + slug;
- this.copied = true;
+ async shareArticle() {
+ const shareUrl = this.seo.getpath();
- setTimeout(() => {
- this.copied = false;
- }, 3000);
+ if (navigator.share) {
+ try {
+ await navigator.share({
+ title: document.title,
+ url: shareUrl
+ });
+ return;
+ } catch (err) {
+ if ((err as Error).name !== 'AbortError') {
+ console.error('Error sharing:', err);
+ } else {
+ return;
+ }
+ }
+ }
- navigator.clipboard.writeText(shareLink).then()
+ try {
+ await navigator.clipboard.writeText(shareUrl);
+ this.copied = true;
+ setTimeout(() => {
+ this.copied = false;
+ }, 3000);
+ } catch (err) {
+ console.error('Failed to copy link:', err);
+ }
}
}
diff --git a/src/app/blog/blog.component.ts b/src/app/blog/blog.component.ts
index 6ca8cb8..2cbf645 100644
--- a/src/app/blog/blog.component.ts
+++ b/src/app/blog/blog.component.ts
@@ -40,7 +40,8 @@ export class BlogComponent implements OnInit {
ngOnInit() {
this.seo.update({
title: 'Blog',
- desc: 'I post updates on the stuff I do here! (sometimes)'
+ desc: 'I post updates on the stuff I do here! (sometimes)',
+ buttons: [{ label: 'View Posts', url: this.seo.getpath() }]
});
this.isNarrow = this.deviceService.isNarrow;
diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts
index f560df5..bbef25d 100644
--- a/src/app/login/login.component.ts
+++ b/src/app/login/login.component.ts
@@ -32,8 +32,9 @@ export class LoginComponent implements OnInit {
ngOnInit() {
this.seo.update({
- title:'Login',
- desc: 'Admin Panel Login'
+ title: 'Admin Panel',
+ desc: 'Management & Administration Panel',
+ buttons: [{ label: 'Log-in', url: this.seo.getpath() }]
})
this.isNarrow = this.deviceService.isNarrow;
diff --git a/src/app/not-found/not-found.component.ts b/src/app/not-found/not-found.component.ts
index a996f31..6de3bb6 100644
--- a/src/app/not-found/not-found.component.ts
+++ b/src/app/not-found/not-found.component.ts
@@ -23,7 +23,8 @@ export class NotFoundComponent implements OnInit {
this.seo.update({
title: '404 | Page Not Found',
desc: 'How the hell did you end up here?',
- suffix: false
+ suffix: false,
+ buttons: [{ label: 'Visit Homepage', url: this.seo.getpath('root') }]
})
}
}
diff --git a/src/app/portfolio/portfolio.component.ts b/src/app/portfolio/portfolio.component.ts
index d799690..271727e 100644
--- a/src/app/portfolio/portfolio.component.ts
+++ b/src/app/portfolio/portfolio.component.ts
@@ -53,7 +53,8 @@ export class PortfolioComponent implements OnInit {
ngOnInit() {
this.seo.update({
title: 'Portfolio',
- desc: 'This is my portfolio where you can find examples of my designs and other projects!'
+ desc: 'This is my portfolio where you can find examples of my designs and other projects!',
+ buttons: [{ label: 'View Projects', url: this.seo.getpath() }]
})
this.isNarrow = this.deviceService.isNarrow;
}
diff --git a/src/app/shared/services/seo.service.ts b/src/app/shared/services/seo.service.ts
index f50ae29..96d3e8b 100644
--- a/src/app/shared/services/seo.service.ts
+++ b/src/app/shared/services/seo.service.ts
@@ -1,23 +1,35 @@
import {Inject, Injectable} from '@angular/core';
-import { Title, Meta } from '@angular/platform-browser';
-import { Router } from '@angular/router';
-import { DOCUMENT } from '@angular/common';
+import {Meta, Title} from '@angular/platform-browser';
+import {Router} from '@angular/router';
+import {DOCUMENT} from '@angular/common';
export interface DiscordButton {
label: string;
url: string;
}
+export interface DiscordGalleryItem {
+ url: string;
+ description?: string;
+ spoiler?: boolean;
+}
+
+export interface SeoConfig {
+ title: string;
+ desc: string;
+ img?: string;
+ url?: string;
+ col?: string;
+ suffix?: boolean;
+ buttons?: DiscordButton[];
+ gallery?: DiscordGalleryItem[];
+}
+
@Injectable({
providedIn: 'root'
})
export class SeoService {
- private readonly rootDomain = 'https://itzminey.dev';
- private readonly defaultImage = 'https://itzminey.dev/assets/ogimg.png';
- private readonly defaultThumb = 'https://itzminey.dev/assets/thumb.png';
- private readonly siteColor = '#0095a4';
-
constructor(
private titleService: Title,
private metaService: Meta,
@@ -25,39 +37,72 @@ export class SeoService {
@Inject(DOCUMENT) private document: Document
) {}
- update(config: { title: string; desc: string; img?: string; suffix?: boolean; buttons?: DiscordButton[];}) {
+ private readonly defaultColor = '#0095a4';
+ private readonly rootDomain = 'https://itzminey.dev';
+
+ getpath(path?: string ) {
+ if (!path) return `${this.rootDomain}${this.router.url}`;
+ if (path === 'root') return this.rootDomain;
+ return `${this.rootDomain}/${path.replace(/^\//, '')}`;
+ }
+
+ private readonly defaultImage = this.getpath('assets/ogimg.png');
+ private readonly siteThumb = this.getpath('assets/thumb.png');
+
+ update(config: SeoConfig) {
const siteName = 'itzMiney';
const appendSuffix = config.suffix ?? true;
- const title = appendSuffix && !config.title.includes(siteName)
+ const title = appendSuffix && !config.title.endsWith(`| ${siteName}`)
? `${config.title} | ${siteName}`
: config.title;
const description = config.desc;
const image = config.img || this.defaultImage;
- const currentUrl = `${this.rootDomain}${this.router.url}`;
+ const currentUrl = this.getpath();
+ const siteColor = config.col || this.defaultColor;
+ const gallery = config.gallery;
- this.titleService.setTitle(title );
+ this.titleService.setTitle(title);
this.metaService.updateTag({ name: 'description', content: description });
this.metaService.updateTag({ property: 'og:title', content: title });
this.metaService.updateTag({ property: 'og:description', content: description });
this.metaService.updateTag({ property: 'og:image', content: image });
this.metaService.updateTag({ property: 'og:url', content: currentUrl });
- this.metaService.updateTag({ name: 'theme-color', content: this.siteColor });
+ this.metaService.updateTag({ name: 'theme-color', content: siteColor });
- this.injectDiscordComponentEmbed(config.buttons, { title, description, image, currentUrl });
+ this.injectDiscordComponentEmbed(config.buttons, gallery, {
+ title,
+ description,
+ image,
+ currentUrl,
+ siteColor
+ });
}
- private injectDiscordComponentEmbed(buttons?: DiscordButton[], meta?: { title: string; description: string; image: string; currentUrl: string }) {
+ private injectDiscordComponentEmbed(
+ buttons?: DiscordButton[],
+ gallery?: DiscordGalleryItem[],
+ meta?: {
+ title: string;
+ description: string;
+ image: string;
+ currentUrl: string;
+ siteColor: string
+ },
+ ) {
const existingScript = this.document.getElementById('discord:component-embed');
if (existingScript) {
existingScript.remove();
}
- const thumb = meta?.image || this.defaultThumb;
+ const thumb = this.siteThumb;
+ const siteColor = meta?.siteColor || this.defaultColor;
- const sectionComponent = {
+ const containerComponents: any[] = [];
+
+ containerComponents.push({
type: 9,
components: [
{
@@ -71,9 +116,23 @@ export class SeoService {
url: thumb
}
}
- };
+ });
- const containerComponents: any[] = [sectionComponent];
+ if (gallery && gallery.length > 0) {
+ containerComponents.push({
+ type: 12,
+ items: gallery.map(item => {
+ const galleryItem: any = {
+ media: {
+ url: item.url
+ }
+ };
+ if (item.description) galleryItem.description = item.description;
+ if (item.spoiler !== undefined) galleryItem.spoiler = item.spoiler;
+ return galleryItem;
+ })
+ });
+ }
if (buttons && buttons.length > 0) {
containerComponents.push({
@@ -91,7 +150,7 @@ export class SeoService {
flags: 32768,
component: {
type: 17,
- accent_color: parseInt(this.siteColor.replace('#', ''), 16),
+ accent_color: parseInt(siteColor.replace('#', ''), 16),
components: containerComponents
}
};