feat(seo): 301 redirect non-www -> www and switch canonical host to www

- nginx.conf: dedicated server block for dealplustech.co.th -> 301 https://www.dealplustech.co.th$request_uri (path + query preserved)
- astro.config site, BaseLayout siteUrl, robots.txt Host/Sitemap, blog + terms links -> www
- fixes duplicate-content between www and non-www; canonical/og:url/sitemap now all www
This commit is contained in:
Kunthawat Greethong committed 2026-11-07 08:47:24 +07:00
1 parent 16dc4d4c6f
commit aa3ceb05d6
6 files changed
+24 -13

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ import path from 'path'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
site: 'https://dealplustech.co.th',
site: 'https://www.dealplustech.co.th',
output: 'static',
vite: {
plugins: [tailwindcss()],
+11
View File
@@ -1,3 +1,14 @@
# =====================================================================
# non-www -> www (301) — canonical host is www.dealplustech.co.th
# =====================================================================
server {
listen 80;
listen [::]:80;
server_name dealplustech.co.th;
return 301 https://www.dealplustech.co.th$request_uri;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
+3 -3
View File
@@ -1,5 +1,5 @@
# robots.txt — ดีล พลัส เทค
# https://dealplustech.co.th
# https://www.dealplustech.co.th
User-agent: *
Allow: /
@@ -35,7 +35,7 @@ User-agent: MJ12bot
Disallow: /
# Host (Yandex/Bing-style, also helps some other crawlers)
Host: https://dealplustech.co.th
Host: https://www.dealplustech.co.th
# Sitemap
Sitemap: https://dealplustech.co.th/sitemap-index.xml
Sitemap: https://www.dealplustech.co.th/sitemap-index.xml
+1 -1
View File
@@ -81,7 +81,7 @@ const fullTitle = hasBrandSuffix ? trimmed : `${trimmed} | ${BRAND}`;
// Organization JSON-LD (rendered on every page so Google can verify the
// publisher of the site). LocalBusiness subtype for Maps/3-pack SEO.
const siteUrl = 'https://dealplustech.co.th';
const siteUrl = 'https://www.dealplustech.co.th';
const organizationSchema = {
'@context': 'https://schema.org',
'@type': 'LocalBusiness',
+2 -2
View File
@@ -3,13 +3,13 @@ import BaseLayout from '@/layouts/BaseLayout.astro';
import { marked } from 'marked';
const termsContent = `**ชื่อเว็บไซต์:** ดีล พลัส เทค
**เว็บไซต์:** https://dealplustech.co.th
**เว็บไซต์:** https://www.dealplustech.co.th
**มีผลบังคับใช้วันที่:** 6 พฤษภาคม 2569
**แก้ไขล่าสุด:** 6 พฤษภาคม 2569
## 1. การยอมรับเงื่อนไข
ด้วยการเข้าถึงและใช้งานเว็บไซต์ https://dealplustech.co.th ("เว็บไซต์") ของบริษัท ดีล พลัส เทค จำกัด ("บริษัท") ท่านยอมรับและตกลงที่จะถูกผูกมัดด้วยข้อกำหนดการใช้งานฉบับนี้
ด้วยการเข้าถึงและใช้งานเว็บไซต์ https://www.dealplustech.co.th ("เว็บไซต์") ของบริษัท ดีล พลัส เทค จำกัด ("บริษัท") ท่านยอมรับและตกลงที่จะถูกผูกมัดด้วยข้อกำหนดการใช้งานฉบับนี้
## 2. บริการของเรา
+6 -6
View File
@@ -29,7 +29,7 @@ const tag = article.data.tags?.[0] ?? '';
// BlogPosting JSON-LD — provides rich result eligibility in Google
// (article cards, author attribution, publish date).
const articleUrl = `https://dealplustech.co.th/${encodeURI('บทความ')}/${article.id}`;
const articleUrl = `https://www.dealplustech.co.th/${encodeURI('บทความ')}/${article.id}`;
const blogPostingSchema = {
'@context': 'https://schema.org',
'@type': 'BlogPosting',
@@ -39,21 +39,21 @@ const blogPostingSchema = {
...(article.data.featured_image && {
image: /^https?:\/\//.test(article.data.featured_image)
? article.data.featured_image
: `https://dealplustech.co.th${article.data.featured_image}`,
: `https://www.dealplustech.co.th${article.data.featured_image}`,
}),
datePublished: article.data.published_at.toISOString(),
dateModified: (article.data.updated_at ?? article.data.published_at).toISOString(),
author: {
'@type': 'Organization',
name: article.data.author || 'ดีล พลัส เทค',
url: 'https://dealplustech.co.th',
url: 'https://www.dealplustech.co.th',
},
publisher: {
'@type': 'Organization',
name: 'ดีล พลัส เทค',
logo: {
'@type': 'ImageObject',
url: 'https://dealplustech.co.th/images/logo/dealplustech-logo.png',
url: 'https://www.dealplustech.co.th/images/logo/dealplustech-logo.png',
},
},
mainEntityOfPage: {
@@ -149,11 +149,11 @@ const faqSchema = faqPairs.length >= 2 ? {
<div class="border-t border-slate-100 pt-8 mb-8">
<div class="flex items-center gap-4">
<span class="text-sm font-medium text-slate-700">แชร์บทความ:</span>
<a href={`https://line.me/R/msg/text/?${encodeURIComponent(`${article.data.title} - https://dealplustech.co.th/${encodeURI('บทความ')}/${encodeURIComponent(article.id)}`)}`} target="_blank" rel="noopener" class="inline-flex items-center gap-2 px-4 py-2 bg-green-50 text-green-600 rounded-xl hover:bg-green-100 transition-colors text-sm font-medium">
<a href={`https://line.me/R/msg/text/?${encodeURIComponent(`${article.data.title} - https://www.dealplustech.co.th/${encodeURI('บทความ')}/${encodeURIComponent(article.id)}`)}`} target="_blank" rel="noopener" class="inline-flex items-center gap-2 px-4 py-2 bg-green-50 text-green-600 rounded-xl hover:bg-green-100 transition-colors text-sm font-medium">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M19.365 9.863c.349 0 .63.285.63.631 0 .345-.281.63-.63.63H17.61v1.125h1.755c.349 0 .63.283.63.63 0 .344-.281.629-.63.629h-2.386c-.345 0-.627-.285-.627-.629V8.108c0-.344.282-.629.627-.629h2.386c.349 0 .63.285.63.63 0 .349-.281.63-.63.63H17.61v1.125h1.755zm-3.855 3.016c0 .27-.174.51-.432.596-.064.021-.133.031-.199.031-.211 0-.391-.09-.51-.25l-2.443-3.317v2.94c0 .344-.279.629-.631.629-.346 0-.626-.285-.626-.629V8.108c0-.27.173-.51.43-.595.06-.023.136-.033.194-.033.195 0 .375.104.495.254l2.462 3.33V8.108c0-.345.282-.629.63-.629.345 0 .63.284.63.629v4.771zm-5.741 0c0 .344-.282.629-.631.629-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.629.627-.629.349 0 .631.284.631.629v4.771zm-2.466.629H4.917c-.345 0-.63-.285-.63-.629V8.108c0-.345.285-.629.63-.629.348 0 .63.284.63.629v4.141h1.756c.348 0 .629.283.629.63 0 .344-.282.629-.629.629M24 10.314C24 4.943 18.615.572 12 .572S0 4.943 0 10.314c0 4.811 4.27 8.842 10.035 9.608.391.082.923.258 1.058.59.12.301.079.766.038 1.08l-.164 1.02c-.045.301-.24 1.186 1.049.645 1.291-.539 6.916-4.078 9.436-6.975C23.176 14.393 24 12.458 18.062 24 10.314\"/></svg>
Line
</a>
<a href={`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`https://dealplustech.co.th/${encodeURI('บทความ')}/${encodeURIComponent(article.id)}`)}`} target="_blank" rel="noopener" class="inline-flex items-center gap-2 px-4 py-2 bg-blue-50 text-blue-600 rounded-xl hover:bg-blue-100 transition-colors text-sm font-medium">
<a href={`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`https://www.dealplustech.co.th/${encodeURI('บทความ')}/${encodeURIComponent(article.id)}`)}`} target="_blank" rel="noopener" class="inline-flex items-center gap-2 px-4 py-2 bg-blue-50 text-blue-600 rounded-xl hover:bg-blue-100 transition-colors text-sm font-medium">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>
Facebook
</a>