mirror of
https://github.com/sergeyyarkov/yarkov.tech.git
synced 2026-10-11 10:29:21 +03:00
fix slug
This commit is contained in:
parent
87ece33516
commit
d68a57be41
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
import type { CollectionEntry } from "astro:content";
|
import type { CollectionEntry } from "astro:content";
|
||||||
import { Icon } from "astro-icon";
|
import { Icon } from "astro-icon";
|
||||||
|
import slugify from "@sindresorhus/slugify";
|
||||||
import { createDateFormatter } from "@root/utils";
|
import { createDateFormatter } from "@root/utils";
|
||||||
import ArticleCover from "@components/ArticleCover.astro";
|
import ArticleCover from "@components/ArticleCover.astro";
|
||||||
import ArticleComments from "@components/ArticleComments.astro";
|
import ArticleComments from "@components/ArticleComments.astro";
|
||||||
@ -17,8 +18,8 @@ const pageLang = getLanguageFromURL(Astro.url.pathname);
|
|||||||
const canonicalUrl = new URL(Astro.url.pathname, Astro.site);
|
const canonicalUrl = new URL(Astro.url.pathname, Astro.site);
|
||||||
const {
|
const {
|
||||||
data: { coverImage, title, author, description, tags, pubDate },
|
data: { coverImage, title, author, description, tags, pubDate },
|
||||||
slug,
|
|
||||||
} = article;
|
} = article;
|
||||||
|
const slug = slugify(title, { lowercase: true });
|
||||||
const t = useTranslation(Astro);
|
const t = useTranslation(Astro);
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { Component } from "solid-js";
|
import type { Component } from "solid-js";
|
||||||
import { createSignal, createEffect, For } from "solid-js";
|
import { createSignal, createEffect, For } from "solid-js";
|
||||||
import { search, selectedTags } from "@stores/searchStore";
|
import { search, selectedTags, setCount } from "@stores/searchStore";
|
||||||
import SearchInput from "./SearchInput";
|
import SearchInput from "./SearchInput";
|
||||||
import TagsList from "./TagsList";
|
import TagsList from "./TagsList";
|
||||||
import ArticleItem from "@components/ArticleItem";
|
import ArticleItem from "@components/ArticleItem";
|
||||||
@ -39,7 +39,7 @@ const ArticlesList: Component<ArticlesListProps> = (props) => {
|
|||||||
params: { search, tags },
|
params: { search, tags },
|
||||||
}: {
|
}: {
|
||||||
params: { search: string; tags?: string[] };
|
params: { search: string; tags?: string[] };
|
||||||
}) => {
|
}): ArticlesBlockType => {
|
||||||
const filter = (cb: (year: string) => ArticlesType) => {
|
const filter = (cb: (year: string) => ArticlesType) => {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
Object.keys(props.articles)
|
Object.keys(props.articles)
|
||||||
@ -60,7 +60,9 @@ const ArticlesList: Component<ArticlesListProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
setArticles(searchArticles({ params: { search: search(), tags: selectedTags() } }));
|
const filtered = searchArticles({ params: { search: search(), tags: selectedTags() } });
|
||||||
|
setArticles(filtered);
|
||||||
|
setCount(Object.values(filtered).flat().length);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user