This commit is contained in:
Sergey Yarkov 2023-02-21 22:55:54 +03:00
parent 87ece33516
commit d68a57be41
No known key found for this signature in database
GPG Key ID: E91CE1FABC619B6F
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
---
import type { CollectionEntry } from "astro:content";
import { Icon } from "astro-icon";
import slugify from "@sindresorhus/slugify";
import { createDateFormatter } from "@root/utils";
import ArticleCover from "@components/ArticleCover.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 {
data: { coverImage, title, author, description, tags, pubDate },
slug,
} = article;
const slug = slugify(title, { lowercase: true });
const t = useTranslation(Astro);
---

View File

@ -1,6 +1,6 @@
import type { Component } 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 TagsList from "./TagsList";
import ArticleItem from "@components/ArticleItem";
@ -39,7 +39,7 @@ const ArticlesList: Component<ArticlesListProps> = (props) => {
params: { search, tags },
}: {
params: { search: string; tags?: string[] };
}) => {
}): ArticlesBlockType => {
const filter = (cb: (year: string) => ArticlesType) => {
return Object.fromEntries(
Object.keys(props.articles)
@ -60,7 +60,9 @@ const ArticlesList: Component<ArticlesListProps> = (props) => {
};
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 (