core-maugli 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "core-maugli",
3
3
  "description": "Astro & Tailwind CSS blog theme for Maugli.",
4
4
  "type": "module",
5
- "version": "1.2.11",
5
+ "version": "1.2.13",
6
6
  "license": "GPL-3.0-or-later OR Commercial",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  ---
2
- import { getFilteredCollection } from '../utils/content-loader';
3
2
  import { maugliConfig } from '../config/maugli.config';
3
+ import { getFilteredCollection } from '../utils/content-loader';
4
4
  import { getPostsByAuthor } from '../utils/data-utils';
5
5
  import AuthorLinksGroup from './AuthorLinksGroup.astro';
6
6
  import Avatar from './Avatar.astro';
@@ -25,10 +25,21 @@ export interface Props {
25
25
  slug: string;
26
26
  };
27
27
  class?: string;
28
+ authorsList?: Array<{ slug: string }>;
28
29
  }
29
30
 
30
- const { author, class: className } = Astro.props;
31
- const { name, position, description, avatar, socials, slug } = author;
31
+ const { author, class: className, authorsList = [] } = Astro.props;
32
+ let currentAuthor = author;
33
+ // Проверяем, есть ли автор среди списка авторов
34
+ if (!authorsList.some((a) => a.slug === author.slug)) {
35
+ // Если нет — используем дефолтного автора
36
+ // Здесь предполагается, что authorsList содержит дефолтного автора
37
+ const defaultAuthor = authorsList.find((a) => a.slug === maugliConfig.defaultAuthorId);
38
+ if (defaultAuthor) {
39
+ currentAuthor = defaultAuthor;
40
+ }
41
+ }
42
+ const { name, position, description, avatar, socials, slug } = currentAuthor;
32
43
 
33
44
  // Получаем количество статей автора через getPostsByAuthor
34
45
  let posts: import('astro:content').CollectionEntry<'blog'>[] = [];
@@ -39,8 +39,27 @@ export function getPostsByTag(posts: CollectionEntry<'blog'>[], tagId: string) {
39
39
  }
40
40
 
41
41
  // Получение автора поста с fallback на дефолтного автора из конфига
42
+
43
+ // Получение автора поста с fallback на дефолтного автора из конфига
44
+ // Если автор не найден среди авторов, возвращаем дефолтного
45
+ import fs from 'fs';
46
+ import path from 'path';
47
+
48
+ function getAuthorSlugs() {
49
+ try {
50
+ const authorsDir = path.join(process.cwd(), 'src/content/authors');
51
+ return fs.readdirSync(authorsDir)
52
+ .filter(f => f.endsWith('.md'))
53
+ .map(f => f.replace('.md', ''));
54
+ } catch {
55
+ return [];
56
+ }
57
+ }
58
+
42
59
  export function getPostAuthor(post: CollectionEntry<'blog'>): string {
43
- return post.data.author || maugliConfig.defaultAuthorId || 'unknown-author';
60
+ const author = post.data.author || maugliConfig.defaultAuthorId || 'unknown-author';
61
+ const authorSlugs = getAuthorSlugs();
62
+ return authorSlugs.includes(author) ? author : (maugliConfig.defaultAuthorId || 'unknown-author');
44
63
  }
45
64
 
46
65
  // Получение постов по автору с учетом дефолтного автора
@@ -1,14 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_105_27)">
3
- <path d="M256 512C397.385 512 512 397.385 512 256C512 114.615 397.385 0 256 0C114.615 0 0 114.615 0 256C0 397.385 114.615 512 256 512Z" fill="#6DA544"/>
4
- <path d="M255.999 100.174L467.477 256L255.999 411.826L44.5215 256L255.999 100.174Z" fill="#FFDA44"/>
5
- <path d="M256 345.043C305.177 345.043 345.043 305.177 345.043 256C345.043 206.823 305.177 166.957 256 166.957C206.823 166.957 166.957 206.823 166.957 256C166.957 305.177 206.823 345.043 256 345.043Z" fill="#F0F0F0"/>
6
- <path d="M211.477 250.435C195.993 250.435 181.05 252.79 166.984 257.16C167.607 305.8 207.211 345.044 255.999 345.044C286.167 345.044 312.811 330.027 328.918 307.076C301.361 272.579 258.96 250.435 211.477 250.435V250.435Z" fill="#0052B4"/>
7
- <path d="M343.392 273.06C344.464 267.536 345.043 261.837 345.043 256C345.043 206.822 305.177 166.957 256 166.957C219.306 166.957 187.806 189.158 174.174 220.856C186.224 218.359 198.7 217.044 211.479 217.044C263.196 217.043 309.982 238.541 343.392 273.06V273.06Z" fill="#0052B4"/>
8
- </g>
9
- <defs>
10
- <clipPath id="clip0_105_27">
11
- <rect width="512" height="512" fill="white"/>
12
- </clipPath>
13
- </defs>
14
- </svg>
@@ -1,15 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_105_19)">
3
- <path d="M256 512C397.385 512 512 397.385 512 256C512 114.615 397.385 0 256 0C114.615 0 0 114.615 0 256C0 397.385 114.615 512 256 512Z" fill="#D80027"/>
4
- <path d="M140.1 155.8L162.2 223.8H233.7L175.9 265.9L198 333.9L140.1 291.9L82.2 333.9L104.4 265.9L46.5 223.8H118L140.1 155.8Z" fill="#FFDA44"/>
5
- <path d="M303.499 396.5L286.599 375.7L261.599 385.4L276.099 362.9L259.199 342L285.099 348.9L299.699 326.4L301.099 353.2L327.099 360.1L301.999 369.7L303.499 396.5Z" fill="#FFDA44"/>
6
- <path d="M337.099 335.5L345.099 309.9L323.199 294.4L349.999 294L357.899 268.4L366.599 293.8L393.399 293.5L371.899 309.5L380.499 334.9L358.599 319.4L337.099 335.5Z" fill="#FFDA44"/>
7
- <path d="M382.401 187.9L370.601 212L389.801 230.7L363.301 226.9L351.501 250.9L346.901 224.5L320.301 220.7L344.101 208.2L339.501 181.7L358.701 200.4L382.401 187.9Z" fill="#FFDA44"/>
8
- <path d="M304.2 114.9L302.2 141.6L327.1 151.7L301 158.1L299.1 184.9L285 162.1L258.9 168.5L276.2 148L262 125.3L286.9 135.4L304.2 114.9Z" fill="#FFDA44"/>
9
- </g>
10
- <defs>
11
- <clipPath id="clip0_105_19">
12
- <rect width="512" height="512" fill="white"/>
13
- </clipPath>
14
- </defs>
15
- </svg>
@@ -1,12 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_105_34)">
3
- <path d="M256 512C397.385 512 512 397.385 512 256C512 114.615 397.385 0 256 0C114.615 0 0 114.615 0 256C0 397.385 114.615 512 256 512Z" fill="#F0F0F0"/>
4
- <path d="M512 256C512 145.929 442.528 52.094 345.043 15.923V496.078C442.528 459.906 512 366.071 512 256V256Z" fill="#D80027"/>
5
- <path d="M0 256C0 366.071 69.473 459.906 166.957 496.077V15.923C69.473 52.094 0 145.929 0 256Z" fill="#0052B4"/>
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_105_34">
9
- <rect width="512" height="512" fill="white"/>
10
- </clipPath>
11
- </defs>
12
- </svg>
@@ -1,12 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_3719_7205)">
3
- <path d="M15.9238 345.043C52.0948 442.527 145.93 512 256.001 512C366.072 512 459.907 442.527 496.078 345.043L256.001 322.783L15.9238 345.043Z" fill="#FFDA44"/>
4
- <path d="M256.001 0C145.93 0 52.0948 69.472 15.9238 166.957L256.001 189.217L496.078 166.956C459.907 69.472 366.072 0 256.001 0Z" fill="black"/>
5
- <path d="M15.923 166.957C5.633 194.69 0 224.686 0 256C0 287.314 5.633 317.31 15.923 345.043H496.078C506.368 317.31 512 287.314 512 256C512 224.686 506.368 194.69 496.077 166.957H15.923Z" fill="#D80027"/>
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_3719_7205">
9
- <rect width="512" height="512" fill="white"/>
10
- </clipPath>
11
- </defs>
12
- </svg>
@@ -1,11 +0,0 @@
1
- <svg width="512" height="513" viewBox="0 0 512 513" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_105_38)">
3
- <path d="M256 512.989C397.385 512.989 512 398.374 512 256.989C512 115.604 397.385 0.989258 256 0.989258C114.615 0.989258 0 115.604 0 256.989C0 398.374 114.615 512.989 256 512.989Z" fill="#F0F0F0"/>
4
- <path d="M255.999 368.293C317.471 368.293 367.303 318.461 367.303 256.989C367.303 195.518 317.471 145.685 255.999 145.685C194.528 145.685 144.695 195.518 144.695 256.989C144.695 318.461 194.528 368.293 255.999 368.293Z" fill="#D80027"/>
5
- </g>
6
- <defs>
7
- <clipPath id="clip0_105_38">
8
- <rect width="512" height="512" fill="white" transform="translate(0 0.989258)"/>
9
- </clipPath>
10
- </defs>
11
- </svg>
@@ -1,12 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_3719_7207)">
3
- <path d="M256 512C397.385 512 512 397.385 512 256C512 114.615 397.385 0 256 0C114.615 0 0 114.615 0 256C0 397.385 114.615 512 256 512Z" fill="#F0F0F0"/>
4
- <path d="M496.077 345.043C506.368 317.31 512 287.314 512 256C512 224.686 506.368 194.69 496.077 166.957H15.923C5.633 194.69 0 224.686 0 256C0 287.314 5.633 317.31 15.923 345.043L256 367.304L496.077 345.043Z" fill="#0052B4"/>
5
- <path d="M256.001 512C366.072 512 459.907 442.528 496.078 345.043H15.9238C52.0948 442.528 145.93 512 256.001 512Z" fill="#D80027"/>
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_3719_7207">
9
- <rect width="512" height="512" fill="white"/>
10
- </clipPath>
11
- </defs>
12
- </svg>
@@ -1,12 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_3719_7208)">
3
- <path d="M0 255.999C0 287.313 5.633 317.309 15.923 345.042L256 367.303L496.077 345.042C506.367 317.309 512 287.313 512 255.999C512 224.685 506.367 194.689 496.077 166.956L256 144.695L15.923 166.956C5.633 194.689 0 224.685 0 255.999H0Z" fill="#FFDA44"/>
4
- <path d="M496.078 166.957C459.907 69.473 366.072 0 256.001 0C145.93 0 52.0948 69.473 15.9238 166.957H496.078Z" fill="#D80027"/>
5
- <path d="M15.9238 345.043C52.0948 442.527 145.93 512 256.001 512C366.072 512 459.907 442.527 496.078 345.043H15.9238Z" fill="#D80027"/>
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_3719_7208">
9
- <rect width="512" height="512" fill="white"/>
10
- </clipPath>
11
- </defs>
12
- </svg>
@@ -1,13 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_105_41)">
3
- <path d="M256 511.999C397.385 511.999 512 397.384 512 255.999C512 114.614 397.385 -0.000976562 256 -0.000976562C114.615 -0.000976562 0 114.614 0 255.999C0 397.384 114.615 511.999 256 511.999Z" fill="#F0F0F0"/>
4
- <path d="M144.695 345.042L166.956 496.078C194.688 506.369 224.685 511.999 255.999 511.999C366.069 511.999 459.905 442.527 496.075 345.042H144.695Z" fill="black"/>
5
- <path d="M144.695 166.956L166.956 15.92C194.688 5.62902 224.685 -0.000976562 255.999 -0.000976562C366.069 -0.000976562 459.905 69.471 496.075 166.956H144.695Z" fill="#6DA544"/>
6
- <path d="M0 255.999C0 366.07 69.473 459.905 166.957 496.076V15.9221C69.473 52.0931 0 145.928 0 255.999Z" fill="#A2001D"/>
7
- </g>
8
- <defs>
9
- <clipPath id="clip0_105_41">
10
- <rect width="512" height="512" fill="white" transform="translate(0 -0.000976562)"/>
11
- </clipPath>
12
- </defs>
13
- </svg>
@@ -1,15 +0,0 @@
1
- <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_3719_7206)">
3
- <path d="M256 512C397.385 512 512 397.385 512 256C512 114.615 397.385 0 256 0C114.615 0 0 114.615 0 256C0 397.385 114.615 512 256 512Z" fill="#F0F0F0"/>
4
- <path d="M244.869 256H511.999C511.999 232.894 508.919 210.51 503.18 189.217H244.869V256Z" fill="#D80027"/>
5
- <path d="M244.869 122.435H474.425C458.754 96.8633 438.717 74.2603 415.355 55.6523H244.869V122.435Z" fill="#D80027"/>
6
- <path d="M255.999 512C316.248 512 371.625 491.176 415.355 456.348H96.6426C140.373 491.176 195.75 512 255.999 512Z" fill="#D80027"/>
7
- <path d="M37.5734 389.566H474.425C487.006 369.037 496.763 346.597 503.18 322.783H8.81836C15.2354 346.597 24.9924 369.037 37.5734 389.566V389.566Z" fill="#D80027"/>
8
- <path d="M118.584 39.978H141.913L120.213 55.743L128.502 81.252L106.803 65.487L85.104 81.252L92.264 59.215C73.158 75.13 56.412 93.776 42.612 114.552H50.087L36.274 124.587C34.122 128.177 32.058 131.824 30.08 135.525L36.676 155.826L24.37 146.885C21.311 153.366 18.513 159.993 15.998 166.758L23.265 189.126H50.087L28.387 204.891L36.676 230.4L14.977 214.635L1.979 224.079C0.678 234.537 0 245.189 0 256H256C256 114.616 256 97.948 256 0C205.428 0 158.285 14.67 118.584 39.978V39.978ZM128.502 230.4L106.803 214.635L85.104 230.4L93.393 204.891L71.693 189.126H98.515L106.803 163.617L115.091 189.126H141.913L120.213 204.891L128.502 230.4ZM120.213 130.317L128.502 155.826L106.803 140.061L85.104 155.826L93.393 130.317L71.693 114.552H98.515L106.803 89.043L115.091 114.552H141.913L120.213 130.317ZM220.328 230.4L198.629 214.635L176.93 230.4L185.219 204.891L163.519 189.126H190.341L198.629 163.617L206.917 189.126H233.739L212.039 204.891L220.328 230.4ZM212.039 130.317L220.328 155.826L198.629 140.061L176.93 155.826L185.219 130.317L163.519 114.552H190.341L198.629 89.043L206.917 114.552H233.739L212.039 130.317ZM212.039 55.743L220.328 81.252L198.629 65.487L176.93 81.252L185.219 55.743L163.519 39.978H190.341L198.629 14.469L206.917 39.978H233.739L212.039 55.743Z" fill="#0052B4"/>
9
- </g>
10
- <defs>
11
- <clipPath id="clip0_3719_7206">
12
- <rect width="512" height="512" fill="white"/>
13
- </clipPath>
14
- </defs>
15
- </svg>