Skip to content

Commit 2f79c5f

Browse files
committed
Normalize canonical site URLs
1 parent 0c5fd52 commit 2f79c5f

20 files changed

Lines changed: 70 additions & 62 deletions

astro.config.mjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ export default defineConfig({
66
output: 'static',
77
outDir: './dist',
88
redirects: {
9-
'/about': '/gioi-thieu',
10-
'/contact': '/lien-he',
11-
'/research': '/nghien-cuu',
12-
'/media': '/truyen-thong',
13-
'/publications': '/cong-bo-khoa-hoc',
14-
'/insights': '/goc-nhin',
15-
'/insights/what-to-expect-from-insights': '/goc-nhin/what-to-expect-from-insights',
16-
'/concepts/organizational-network-analysis': '/khai-niem/phan-tich-mang-luoi-to-chuc',
17-
'/concepts/ai-champions': '/khai-niem/nguoi-tien-phong-ai',
18-
'/concepts/betweenness-centrality': '/khai-niem/do-trung-tam-trung-gian',
9+
'/about': '/gioi-thieu/',
10+
'/contact': '/lien-he/',
11+
'/research': '/nghien-cuu/',
12+
'/media': '/truyen-thong/',
13+
'/publications': '/cong-bo-khoa-hoc/',
14+
'/insights': '/goc-nhin/',
15+
'/insights/what-to-expect-from-insights': '/goc-nhin/what-to-expect-from-insights/',
16+
'/concepts/organizational-network-analysis': '/khai-niem/phan-tich-mang-luoi-to-chuc/',
17+
'/concepts/ai-champions': '/khai-niem/nguoi-tien-phong-ai/',
18+
'/concepts/betweenness-centrality': '/khai-niem/do-trung-tam-trung-gian/',
1919
},
2020
});

src/components/Footer.astro

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import en from '../i18n/en';
55
const ui = en;
66
77
const quickLinks = [
8-
{ label: ui.nav.training, href: '/dao-tao' },
9-
{ label: ui.nav.consulting, href: '/tu-van' },
10-
{ label: ui.nav.events, href: '/su-kien' },
11-
{ label: ui.nav.about, href: '/gioi-thieu' },
12-
{ label: ui.nav.research, href: '/nghien-cuu' },
8+
{ label: ui.nav.training, href: '/dao-tao/' },
9+
{ label: ui.nav.consulting, href: '/tu-van/' },
10+
{ label: ui.nav.events, href: '/su-kien/' },
11+
{ label: ui.nav.about, href: '/gioi-thieu/' },
12+
{ label: ui.nav.research, href: '/nghien-cuu/' },
1313
{ label: ui.nav.insights, href: '/goc-nhin/' },
14-
{ label: ui.nav.media, href: '/truyen-thong' },
15-
{ label: ui.nav.publications, href: '/cong-bo-khoa-hoc' },
16-
{ label: ui.nav.contact, href: '/lien-he' },
14+
{ label: ui.nav.media, href: '/truyen-thong/' },
15+
{ label: ui.nav.publications, href: '/cong-bo-khoa-hoc/' },
16+
{ label: ui.nav.contact, href: '/lien-he/' },
1717
];
1818
1919
---

src/components/Header.astro

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ const { currentPath } = Astro.props;
99
const ui = en;
1010
1111
const navItems = [
12-
{ label: ui.navShort.training, href: '/dao-tao' },
13-
{ label: ui.navShort.consulting, href: '/tu-van' },
14-
{ label: ui.navShort.events, href: '/su-kien' },
15-
{ label: ui.navShort.research, href: '/nghien-cuu' },
16-
{ label: ui.navShort.media, href: '/truyen-thong' },
17-
{ label: ui.navShort.about, href: '/gioi-thieu' },
18-
{ label: ui.navShort.contact, href: '/lien-he' },
12+
{ label: ui.navShort.training, href: '/dao-tao/' },
13+
{ label: ui.navShort.consulting, href: '/tu-van/' },
14+
{ label: ui.navShort.events, href: '/su-kien/' },
15+
{ label: ui.navShort.research, href: '/nghien-cuu/' },
16+
{ label: ui.navShort.media, href: '/truyen-thong/' },
17+
{ label: ui.navShort.about, href: '/gioi-thieu/' },
18+
{ label: ui.navShort.contact, href: '/lien-he/' },
1919
];
2020
2121
const homeHref = '/';

src/layouts/BaseLayout.astro

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ const {
2626
2727
const ui = en;
2828
const siteOrigin = Astro.site ?? new URL('https://drduydangpham.com');
29-
const toAbsoluteUrl = (url: string) => new URL(url, siteOrigin).toString();
30-
const canonicalAbsolute = toAbsoluteUrl(canonicalUrl);
29+
const toCanonicalUrl = (url: string) => {
30+
const absoluteUrl = new URL(url, siteOrigin);
31+
32+
if (!absoluteUrl.pathname.includes('.') && !absoluteUrl.pathname.endsWith('/')) {
33+
absoluteUrl.pathname = `${absoluteUrl.pathname}/`;
34+
}
35+
36+
return absoluteUrl.toString();
37+
};
38+
const canonicalAbsolute = toCanonicalUrl(canonicalUrl);
3139
const currentPath = new URL(canonicalAbsolute).pathname;
3240
---
3341

src/pages/cong-bo-khoa-hoc.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getPublications, groupPublicationsByYear } from '../utils/publications'
66
const title = 'Công bố khoa học';
77
const description =
88
'Các bài báo khoa học, kỷ yếu hội nghị và chương sách của Tiến sĩ Duy Đặng về phân tích mạng lưới tổ chức, chiến lược AI, an ninh thông tin và chuyển đổi số.';
9-
const canonicalUrl = '/cong-bo-khoa-hoc';
9+
const canonicalUrl = '/cong-bo-khoa-hoc/';
1010
1111
const publications = await getPublications();
1212
const groupedPublications = groupPublicationsByYear(publications);

src/pages/dao-tao.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { personSchema } from '../data/schema-person';
55
const title = 'Đào tạo / Chia sẻ';
66
const description =
77
'Đào tạo, giảng dạy đại học, chia sẻ học thuật và đào tạo AI cho doanh nghiệp của Tiến sĩ Duy Đặng.';
8-
const canonicalUrl = '/dao-tao';
8+
const canonicalUrl = '/dao-tao/';
99
1010
const heroImages = {
1111
workshop: '/images/dao-tao/hero-workshop-720x900.jpg',
@@ -127,7 +127,7 @@ const gallerySlots = [
127127
trong tổ chức.
128128
</p>
129129
<div class="training-hero__actions">
130-
<a class="btn btn--primary" href="/lien-he">Trao đổi chương trình đào tạo</a>
130+
<a class="btn btn--primary" href="/lien-he/">Trao đổi chương trình đào tạo</a>
131131
<a class="btn btn--secondary" href="#academic">Xem các không gian giảng dạy</a>
132132
</div>
133133
</div>
@@ -277,7 +277,7 @@ const gallerySlots = [
277277
<section class="training-cta">
278278
<p class="training-eyebrow">Cùng thiết kế một buổi học</p>
279279
<h2>Một chương trình tốt không bắt đầu từ slide. Nó bắt đầu từ câu hỏi đúng.</h2>
280-
<a class="btn btn--primary" href="/lien-he">Bắt đầu trao đổi</a>
280+
<a class="btn btn--primary" href="/lien-he/">Bắt đầu trao đổi</a>
281281
</section>
282282
</div>
283283
</BaseLayout>

src/pages/gioi-thieu.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { hasProfilePortrait, profilePortraitSrc } from '../utils/portrait';
66
const title = 'Giới thiệu';
77
const description =
88
'Giới thiệu Dr. Duy Dang-Pham, Senior Lecturer tại RMIT University Vietnam, Co-founder của NetIQ và Fulbright Scholar-in-Residence 2024.';
9-
const canonicalUrl = '/gioi-thieu';
9+
const canonicalUrl = '/gioi-thieu/';
1010
---
1111

1212
<BaseLayout
@@ -106,8 +106,8 @@ const canonicalUrl = '/gioi-thieu';
106106
</p>
107107

108108
<ul>
109-
<li><strong>Xem nghiên cứu</strong> — <a href="/nghien-cuu">Nghiên cứu và công bố</a></li>
110-
<li><strong>Làm việc cùng NetIQ</strong> — <a href="/tu-van">Tư vấn / Giải pháp</a></li>
109+
<li><strong>Xem nghiên cứu</strong> — <a href="/nghien-cuu/">Nghiên cứu và công bố</a></li>
110+
<li><strong>Làm việc cùng NetIQ</strong> — <a href="/tu-van/">Tư vấn / Giải pháp</a></li>
111111
</ul>
112112
</div>
113113
</section>
@@ -491,7 +491,7 @@ const canonicalUrl = '/gioi-thieu';
491491
<span class="connect-link__icon" aria-hidden="true">🔬</span>
492492
ORCID 0000-0002-7798-6635
493493
</a>
494-
<a class="connect-link" href="/lien-he">
494+
<a class="connect-link" href="/lien-he/">
495495
<span class="connect-link__icon" aria-hidden="true">✉️</span>
496496
Biểu mẫu liên hệ
497497
</a>

src/pages/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ const ecosystemTiles = [
109109
<span>Bốn việc khác nhau, cùng một niềm tin: hiểu nhau hơn để quyết định tốt hơn.</span>
110110
</p>
111111
<div class="home-hero__actions">
112-
<a class="btn btn--primary" href="/lien-he">Bắt đầu câu chuyện</a>
113-
<a class="btn btn--secondary" href="/gioi-thieu">Về Tiến sĩ Duy Đặng</a>
112+
<a class="btn btn--primary" href="/lien-he/">Bắt đầu câu chuyện</a>
113+
<a class="btn btn--secondary" href="/gioi-thieu/">Về Tiến sĩ Duy Đặng</a>
114114
<a class="btn btn--secondary" href="/goc-nhin/">Góc nhìn</a>
115115
</div>
116116

src/pages/khai-niem/do-trung-tam-trung-gian.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import BaseLayout from '../../layouts/BaseLayout.astro';
33
import { createConceptPageSchema } from '../../data/schema-concept-page';
44
5-
const canonicalUrl = '/khai-niem/do-trung-tam-trung-gian';
5+
const canonicalUrl = '/khai-niem/do-trung-tam-trung-gian/';
66
77
const jsonLd = createConceptPageSchema({
88
name: 'Betweenness Centrality',
@@ -79,7 +79,7 @@ const faqs = jsonLd[1].mainEntity;
7979
<div class="container--content">
8080
<header class="concept-header">
8181
<div class="concept-header__eyebrow">
82-
<a href="/nghien-cuu">Research</a> / Concepts
82+
<a href="/nghien-cuu/">Research</a> / Concepts
8383
</div>
8484
<h1>Betweenness Centrality</h1>
8585
<p class="concept-header__abbr">Bridge metric</p>
@@ -202,11 +202,11 @@ const faqs = jsonLd[1].mainEntity;
202202
<nav class="related-concepts" aria-label="Related concepts">
203203
<h2>Related concepts</h2>
204204
<div class="related-grid">
205-
<a class="related-card" href="/khai-niem/phan-tich-mang-luoi-to-chuc">
205+
<a class="related-card" href="/khai-niem/phan-tich-mang-luoi-to-chuc/">
206206
<strong>Organisational Network Analysis</strong>
207207
<p>The broader method that uses betweenness to reveal informal bridges and bottlenecks.</p>
208208
</a>
209-
<a class="related-card" href="/khai-niem/nguoi-tien-phong-ai">
209+
<a class="related-card" href="/khai-niem/nguoi-tien-phong-ai/">
210210
<strong>AI Champions</strong>
211211
<p>How betweenness helps identify Oracle and Broker archetypes for AI adoption programs.</p>
212212
</a>

src/pages/khai-niem/nguoi-tien-phong-ai.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import BaseLayout from '../../layouts/BaseLayout.astro';
33
import { createConceptPageSchema } from '../../data/schema-concept-page';
44
5-
const canonicalUrl = '/khai-niem/nguoi-tien-phong-ai';
5+
const canonicalUrl = '/khai-niem/nguoi-tien-phong-ai/';
66
77
const title = 'AI Champion — Người tiên phong AI';
88
const description =
@@ -234,12 +234,12 @@ const jsonLd = createConceptPageSchema({
234234
<h2>Đặt AI Champion vào đúng bản đồ.</h2>
235235
</div>
236236
<div class="champion-related__grid">
237-
<a class="related-card" href="/khai-niem/phan-tich-mang-luoi-to-chuc">
237+
<a class="related-card" href="/khai-niem/phan-tich-mang-luoi-to-chuc/">
238238
<span>Khái niệm nền tảng</span>
239239
<strong>Phân tích mạng lưới tổ chức</strong>
240240
<p>Cách ONA làm rõ ảnh hưởng, niềm tin, silo và các cầu nối trong tổ chức.</p>
241241
</a>
242-
<a class="related-card" href="/khai-niem/do-trung-tam-trung-gian">
242+
<a class="related-card" href="/khai-niem/do-trung-tam-trung-gian/">
243243
<span>Chỉ số mạng lưới</span>
244244
<strong>Độ trung tâm trung gian</strong>
245245
<p>Chỉ số giúp nhận diện những người kết nối các phần khác nhau của mạng lưới.</p>

0 commit comments

Comments
 (0)