- Merge the duplicate Organization/LocalBusiness JSON-LD blocks (home's LocalBusiness + o-kompanii's Organization) into one shared getOrganizationSchema() call rendered on every page. Deliberately NOT wired through the root layout: fetches there get frozen into the static shell at build time (backend unreachable during image build) and never revalidate, silently serving stale data to crawlers - each page calls it directly instead, where revalidation is proven to work. - Add optional ItemList schema on /uslugi and Offer/OfferCatalog schema on /aktsii; entity pages (/uslugi/[slug] Service, /blog/[slug] Article) reference the organization via @id instead of duplicating it. - Add 8 more real FAQ entries (pricing model, contract terms, onboarding time, hybrid IT staff setup, supported stacks, backups, 152-FZ compliance, escalation) and give every FAQ its own slug and dedicated /faq/[slug] page with its own title/H1/FAQPage schema, modeled on the one-topic-per-page pattern (h/t remontka.pro). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013otXCiTZsxdZ4SJKZ9wUky
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
// Используется только внутри Server Component'ов (во время SSR/сборки).
|
|
// Обращается к бэкенду напрямую по внутреннему docker-адресу, минуя Caddy -
|
|
// это работает только на сервере Next.js, у браузера такого адреса нет.
|
|
const BASE = process.env.BACKEND_INTERNAL_URL || 'http://backend:4000';
|
|
|
|
async function get(path, { revalidate = 60 } = {}) {
|
|
try {
|
|
const res = await fetch(`${BASE}/api${path}`, { next: { revalidate } });
|
|
if (!res.ok) return null;
|
|
return res.json();
|
|
} catch (err) {
|
|
console.error(`[serverApi] failed to fetch ${path}`, err.message);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export const serverApi = {
|
|
getServices: () => get('/services').then((v) => v || []),
|
|
getPromotions: () => get('/promotions').then((v) => v || []),
|
|
getReviews: () => get('/reviews').then((v) => v || []),
|
|
getCases: () => get('/cases').then((v) => v || []),
|
|
getFaqs: () => get('/faqs').then((v) => v || []),
|
|
getFaq: (slug) => get(`/faqs/${slug}`),
|
|
getContact: () => get('/contact'),
|
|
getBlogPosts: () => get('/blog').then((v) => v || []),
|
|
getBlogPost: (slug) => get(`/blog/${slug}`, { revalidate: 60 }),
|
|
};
|