Skip to content

Commit 4da9e0f

Browse files
authored
Norwegian tag for crude oil assays and enable english crude for norwe… (#3554)
* Norwegian tag for crude oil assays and enable english crude for norwegian users * Utm tags on newsletter
1 parent 2f09f1b commit 4da9e0f

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

web/pages/api/newsletter-rss/groq.global.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
21
import { functions } from '../../../lib/queries/common/functions'
32
import { ingressForNewsQuery } from '../../../lib/queries/common/newsSubqueries'
43
import { publishDateTimeQuery } from '../../../lib/queries/common/publishDateTime'
5-
import { noDrafts, sameLang } from '../../../lib/queries/common/langAndDrafts'
4+
import { sameLang } from '../../../lib/queries/common/langAndDrafts'
65
import type { ImageWithCaptionData } from '../../../types'
76
import type { PortableTextBlock } from '@portabletext/types'
87

@@ -22,7 +21,7 @@ export type LatestNewsType = {
2221

2322
export 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
`
3736
export 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,

web/pages/api/newsletter-rss/index.global.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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 />'}

web/pages/api/subscriptionNew.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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':

0 commit comments

Comments
 (0)