File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 11import { functions } from '../../../lib/queries/common/functions'
22import { ingressForNewsQuery } from '../../../lib/queries/common/newsSubqueries'
33import { publishDateTimeQuery } from '../../../lib/queries/common/publishDateTime'
4- import { sameLang } from '../../../lib/queries/common/langAndDrafts'
4+ import { sameLang , noDrafts } from '../../../lib/queries/common/langAndDrafts'
55import type { ImageWithCaptionData } from '../../../types'
66import type { PortableTextBlock } from '@portabletext/types'
77
@@ -21,7 +21,7 @@ export type LatestNewsType = {
2121
2222export const latestNews = /* groq */ `
2323${ functions }
24- *[_type == "news" && ((defined(subscriptionType) && ${ sameLang } ) || subscriptionType == "Crude")] | order(${ publishDateTimeQuery } desc)[0...5] {
24+ *[_type == "news" && ((defined(subscriptionType) && ${ sameLang } ) || subscriptionType == "Crude") && ${ noDrafts } ] | order(${ publishDateTimeQuery } desc)[0...5] {
2525 _id,
2626 "type":_type,
2727 "slug": slug.current,
@@ -35,7 +35,7 @@ ${functions}
3535`
3636export const latestMagazine = /* groq */ `
3737${ functions }
38- *[_type == "magazine" && shouldDistributeMagazine && ${ sameLang } ] | order(${ publishDateTimeQuery } desc)[0...5] {
38+ *[_type == "magazine" && shouldDistributeMagazine && ${ sameLang } && ${ noDrafts } ] | order(${ publishDateTimeQuery } desc)[0...5] {
3939 _id,
4040 "type":_type,
4141 "slug": slug.current,
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ const generateRssFeed = async (locale: 'en_GB' | 'nb_NO') => {
1313 try {
1414 // Fetch both English and Norwegian articles from news and magazine
1515 const [ newsArticles , magazineArticles ] = await Promise . all ( [
16- sanityClient . fetch ( latestNews , { lang : locale } , { perspective : 'published' } ) ,
17- sanityClient . fetch ( latestMagazine , { lang : locale } , { perspective : 'published' } ) ,
16+ sanityClient . fetch ( latestNews , { lang : locale } ) ,
17+ sanityClient . fetch ( latestMagazine , { lang : locale } ) ,
1818 ] )
1919
2020 // Merge the articles and sort by publish date (newest first)
You can’t perform that action at this time.
0 commit comments