Skip to content

Commit

Permalink
Update news
Browse files Browse the repository at this point in the history
  • Loading branch information
samwisekind committed Nov 10, 2024
1 parent a6c52de commit c9fae37
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/helpers/getNews.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ afterEach(() => {
jest.clearAllMocks();
});

it('Queries new articlesit', async () => {
it('Queries news articles', async () => {
const result = await getNews({ limit: 12 });

expect(contentfulDeliveryClient.getEntries).toHaveBeenCalledTimes(1);
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/getNews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { contentfulDeliveryClient } from './contentful';
import { flattenImageAssetFields } from './flattenAssetFields';

interface Options {
limit: number,
limit?: number,
}

/**
* Queries and returns news articles entries from Contentful.
* @param options Options.
* @param options.limit Number of entries to query.
* @param [options.limit] Number of entries to query.
* @returns News article entries.
*/
const getNews = async ({
limit,
limit = 1000,
}: Options): Promise<Array<NewsArticle>> => {
const { items } = await contentfulDeliveryClient.getEntries<ContentTypeNews>({
content_type: ContentTypes.NewsArticle,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/news/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Page: NextPage<PageProps> = ({
);

export const getServerSideProps: GetServerSideProps<PageProps> = async () => {
const data = await getNews({ limit: 12 });
const data = await getNews({ limit: 1000 });

return {
props: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sitemap.xml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getServerSideProps: GetServerSideProps = async ({ res }) => {
const additionalPages = [];

if (species) {
additionalPages.push(...species.map(({ slug }) => `/species/${slug}`));
additionalPages.push(...species.map(({ slug }) => `/education/species/${slug}`));
}

if (news) {
Expand Down

0 comments on commit c9fae37

Please sign in to comment.