File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed
Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1-
21import { functions } from '../../../lib/queries/common/functions'
32import { ingressForNewsQuery } from '../../../lib/queries/common/newsSubqueries'
43import { publishDateTimeQuery } from '../../../lib/queries/common/publishDateTime'
5- import { noDrafts , sameLang } from '../../../lib/queries/common/langAndDrafts'
4+ import { sameLang } from '../../../lib/queries/common/langAndDrafts'
65import type { ImageWithCaptionData } from '../../../types'
76import type { PortableTextBlock } from '@portabletext/types'
87
@@ -22,7 +21,7 @@ export type LatestNewsType = {
2221
2322export const latestNews = /* groq */ `
2423${ functions }
25- *[_type == "news" && defined(subscriptionType) && ${ sameLang } && ${ noDrafts } ] | order(${ publishDateTimeQuery } desc)[0...5] {
24+ *[_type == "news" && (( defined(subscriptionType) && ${ sameLang } ) || subscriptionType == "Crude") ] | order(${ publishDateTimeQuery } desc)[0...5] {
2625 _id,
2726 "type":_type,
2827 "slug": slug.current,
@@ -36,7 +35,7 @@ ${functions}
3635`
3736export const latestMagazine = /* groq */ `
3837${ functions }
39- *[_type == "magazine" && shouldDistributeMagazine && ${ sameLang } && ${ noDrafts } ] | order(${ publishDateTimeQuery } desc)[0...5] {
38+ *[_type == "magazine" && shouldDistributeMagazine && ${ sameLang } ] | order(${ publishDateTimeQuery } desc)[0...5] {
4039 _id,
4140 "type":_type,
4241 "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 } ) ,
17- sanityClient . fetch ( latestMagazine , { lang : locale } ) ,
16+ sanityClient . fetch ( latestNews , { lang : locale } , { perspective : 'published' } ) ,
17+ sanityClient . fetch ( latestMagazine , { lang : locale } , { perspective : 'published' } ) ,
1818 ] )
1919
2020 // Merge the articles and sort by publish date (newest first)
@@ -72,8 +72,8 @@ const generateRssFeed = async (locale: 'en_GB' | 'nb_NO') => {
7272 rss += `
7373 <item>
7474 <title>${ title } </title>
75- <link>https://www.equinor.com${ langPath } ${ article . slug } </link>
76- <guid>https://www.equinor.com${ langPath } ${ article . slug } </guid>
75+ <link>https://www.equinor.com${ langPath } ${ article . slug } ?utm_source=newssubscription&utm_medium=email </link>
76+ <guid>https://www.equinor.com${ langPath } ${ article . slug } ?utm_source=newssubscription&utm_medium=email </guid>
7777 <pubDate>${ publishDate } </pubDate>
7878 <description>${ toPlainText ( article . ingress ) } </description>
7979 ${ categoryTag ? `<category>${ mapCategoryToId ( categoryTag , locale ) } </category>` : '<category />' }
Original file line number Diff line number Diff line change @@ -36,13 +36,13 @@ export const mapCategoryToId = (category: string, locale: 'no' | 'en') => {
3636 if ( locale === 'no' ) {
3737 switch ( category ) {
3838 case 'generalNews' :
39- return 'generelle nyheter'
39+ return 'generelle nyheter'
4040 case 'Company' :
41- return 'generelle nyheter'
41+ return 'generelle nyheter'
4242 case 'crudeOilAssays' :
43- return 'crude oil assays'
43+ return 'crude oil assays (englesk)'
4444 case 'Crude' :
45- return 'crude oil assays'
45+ return 'crude oil assays (englesk) '
4646 case 'magazineStories' :
4747 return 'magasinsaker'
4848 case 'stockMarketAnnouncements' :
@@ -53,7 +53,7 @@ export const mapCategoryToId = (category: string, locale: 'no' | 'en') => {
5353 } else {
5454 switch ( category ) {
5555 case 'generalNews' :
56- return 'general news'
56+ return 'general news'
5757 case 'Company' :
5858 return 'general news'
5959 case 'crudeOilAssays' :
You can’t perform that action at this time.
0 commit comments