Обновлены метаданные в компоненте layout для SEO, изменены адреса в компонентах Contacts и Footer, улучшена структура отображения контактов. Добавлен динамический заголовок и описание для страницы услуги с использованием useEffect в компоненте ServicePage.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
import {
|
||||
ArrowLeft,
|
||||
@ -33,6 +33,24 @@ export default function ServicePage({ params }: ServicePageProps) {
|
||||
const { slug } = use(params);
|
||||
const service = services.find((s) => s.slug === slug);
|
||||
|
||||
// Добавляем динамический заголовок и описание для SEO
|
||||
useEffect(() => {
|
||||
if (service) {
|
||||
document.title = `${service.title} | СКЭ Проект`;
|
||||
const metaDescription = document.querySelector(
|
||||
'meta[name="description"]'
|
||||
);
|
||||
if (metaDescription) {
|
||||
metaDescription.setAttribute('content', service.description);
|
||||
} else {
|
||||
const meta = document.createElement('meta');
|
||||
meta.name = 'description';
|
||||
meta.content = service.description;
|
||||
document.head.appendChild(meta);
|
||||
}
|
||||
}
|
||||
}, [service]);
|
||||
|
||||
if (!service) {
|
||||
return <div>Услуга не найдена</div>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user