From 0b230a26b4d01f9e11edc4df2b62d3fef8b8259d Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Tue, 3 Mar 2020 03:05:34 +0300 Subject: [PATCH] feed generator updated to tags --- scripts/feed.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/feed.js b/scripts/feed.js index 65e766b5..1e0baedc 100644 --- a/scripts/feed.js +++ b/scripts/feed.js @@ -6,9 +6,12 @@ const api = axios.create({ baseURL: 'https://api.tmshv.com/hudozka', }) -async function getArticles(pageSize) { - const page = 1 - const res = await api.get(`/api/articles?page=${page}&pageSize=${pageSize}`) +async function getArticles(limit) { + const query = ['post', 'event', 'album'] + .map(t => `tag=${t}`) + .join('&') + const url = `/api/pages/tags?${query}&sortBy=-date&skip=0&pageSize=${limit}` + const res = await api.get(url) return res.data.items } @@ -32,7 +35,7 @@ async function getArticles(pageSize) { date: new Date(article.date), id: article.id, link: article.url, - content: article.post, + content: article.data, }) })