diff --git a/src/components/CategoryBadge.astro b/src/components/CategoryBadge.astro
index 9afc10b..f52d036 100644
--- a/src/components/CategoryBadge.astro
+++ b/src/components/CategoryBadge.astro
@@ -2,10 +2,18 @@
export interface Props {
name?: string;
color?: string;
+ href?: string;
+ isNews?: boolean;
class?: string;
}
-const { name, color = '', class: className = '' } = Astro.props;
+const {
+ name,
+ color = '',
+ href,
+ isNews = false,
+ class: className = ''
+} = Astro.props;
function extractColorClass(colorString: string): string {
if (!colorString) return 'bg-blue';
@@ -32,10 +40,100 @@ function extractColorClass(colorString: string): string {
}
const bgClass = extractColorClass(color);
+const Tag = href ? 'a' : 'span';
---
-{name && (
-
- {name}
-
-)}
+
+ {/* Плашка новости, если isNews = true */}
+ {isNews && (
+
+ новости
+
+ )}
+
+ {/* Плашка рубрики */}
+ {name && (
+ e.stopPropagation()}
+ >
+ {name}
+
+ )}
+
+
+
\ No newline at end of file
diff --git a/src/components/ContentGrid.astro b/src/components/ContentGrid.astro
index 162a158..b453d25 100644
--- a/src/components/ContentGrid.astro
+++ b/src/components/ContentGrid.astro
@@ -84,19 +84,16 @@ function shouldBeLarge(index: number): boolean {
) : (
)}
-
- {item.categories?.nodes?.[0] && (
- e.stopPropagation()}
- >
-
-
- )}
+
+
+ {item.categories?.nodes?.[0] && (
+
+ )}
diff --git a/src/components/Header/Header.astro b/src/components/Header/Header.astro
index 5b9ddc3..8dd5d14 100644
--- a/src/components/Header/Header.astro
+++ b/src/components/Header/Header.astro
@@ -1,56 +1,82 @@
---
-
- const { category } = Astro.props;
+const { category, contentType } = Astro.props;
- import Stores from './LazyStores.astro';
- import MainMenu from '@components/MainMenu.astro';
-
- const MENU_ID = 3340; // 103246 (бургер 1). 103247 (бургер 2 )
- let menuItems = [];
+import Stores from './LazyStores.astro';
+import MainMenu from '@components/MainMenu.astro';
+const MENU_ID = 3340; // 103246 (бургер 1). 103247 (бургер 2 )
+let menuItems = [];
---
-
\ No newline at end of file
diff --git a/src/layouts/MainLayout.astro b/src/layouts/MainLayout.astro
index cc0ddbd..5f759dc 100644
--- a/src/layouts/MainLayout.astro
+++ b/src/layouts/MainLayout.astro
@@ -1,6 +1,6 @@
---
-const { title, description, category } = Astro.props;
+const { title, description, category, contentType } = Astro.props;
import Header from '../components/Header/Header.astro';
import Header_lite from '../components/Header/Header_lite.astro';
@@ -28,7 +28,8 @@ import '../styles/global.css';
-
+
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 005a3e1..ae8924c 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -19,7 +19,6 @@ import MainLine from '@components/MainLine.astro';
import HomeNews from "@components/HomeNews.astro";
-
//ISR
export const prerender = false;
---
diff --git a/src/pages/news/[...slug].astro b/src/pages/news/[...slug].astro
index d6cf4d5..b902aa1 100644
--- a/src/pages/news/[...slug].astro
+++ b/src/pages/news/[...slug].astro
@@ -3,6 +3,7 @@ import MainLayout from '@layouts/MainLayout.astro';
import NewsSingle from '@components/NewsSingle.astro';
import { detectPageType } from '@lib/detect-page-type';
+import { wpInfo } from '@lib/wpInfo';
import { getAnewById } from '@lib/api/posts';
export const prerender = false;
@@ -10,6 +11,14 @@ export const prerender = false;
const pathname = Astro.url.pathname;
const pageInfo = detectPageType(pathname);
+
+// Определяем категорию
+if (!wpInfo.isLoaded()) {
+ await wpInfo.fetchAllCategories();
+}
+
+const category = wpInfo.getCategoryBySlug(pageInfo.categorySlug);
+
const fullUrl = Astro.url.href;
const fullPath = Astro.url.origin + Astro.url.pathname;
@@ -39,7 +48,11 @@ if (import.meta.env.DEV) {
}
---
-
+
{pageInfo.type === 'single' && post ? (
diff --git a/src/pages/news/index.astro b/src/pages/news/index.astro
new file mode 100644
index 0000000..e021b7a
--- /dev/null
+++ b/src/pages/news/index.astro
@@ -0,0 +1,12 @@
+---
+
+import MainLayout from '@layouts/MainLayout.astro';
+
+---
+
+
+Все новости
+
\ No newline at end of file
diff --git a/src/styles/components/ContentGrid.css b/src/styles/components/ContentGrid.css
index ca49317..83bced4 100644
--- a/src/styles/components/ContentGrid.css
+++ b/src/styles/components/ContentGrid.css
@@ -97,26 +97,7 @@
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
-/* Бейдж категории */
-.post-category-badge {
- position: absolute;
- top: 15px;
- right: 15px;
- background: #2563eb;
- color: white;
- padding: 5px 10px;
- border-radius: 4px;
- font-size: 11px;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.5px;
- z-index: 2;
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
- max-width: 80%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
+
/* Оверлей с контентом */
.post-content-overlay {
@@ -137,6 +118,10 @@
gap: 8px;
}
+
+
+
+
.post-meta-overlay {
margin-bottom: 3px;
}
@@ -160,6 +145,11 @@
text-overflow: ellipsis;
}
+.category-badge-white{
+ background-color: white;
+ color: black;
+}
+
.author-name {
font-size: 12px;
color: rgba(255, 255, 255, 0.85);