Merge branch 'develop' into v1.1

This commit is contained in:
Hossein Mehrabi 2024-02-01 13:03:19 +03:30 committed by GitHub
commit 6cae0d5b6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 43 additions and 6 deletions

View File

@ -10,6 +10,10 @@ EXPOSE ${PORT}
ARG SIMPLECAST_ACCESS_TOKEN ARG SIMPLECAST_ACCESS_TOKEN
ARG REVALIDATE_WEBHOOK_TOKEN ARG REVALIDATE_WEBHOOK_TOKEN
ARG STRAPI_API_KEY ARG STRAPI_API_KEY
# Strapi URL
ARG STRAPI_API_URL
ARG STRAPI_GRAPHQL_URL
ARG NEXT_PUBLIC_ASSETS_BASE_URL
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1

23
Jenkinsfile vendored
View File

@ -7,6 +7,21 @@ pipeline {
defaultValue: params.IMAGE_TAG ?: '', defaultValue: params.IMAGE_TAG ?: '',
description: 'Optional Docker image tag to push.' description: 'Optional Docker image tag to push.'
) )
string(
name: 'STRAPI_API_URL',
description: 'URL of Strapi API',
defaultValue: params.STRAPI_API_URL ?: 'https://cms-press.logos.co/api',
)
string(
name: 'STRAPI_GRAPHQL_URL',
description: 'URL of Strapi GraphQL API',
defaultValue: params.STRAPI_GRAPHQL_URL ?: 'https://cms-press.logos.co/graphql',
)
string(
name: 'NEXT_PUBLIC_ASSETS_BASE_URL',
description: 'URL for public assets',
defaultValue: params.NEXT_PUBLIC_ASSETS_BASE_URL ?: 'https://cms-press.logos.co',
)
} }
options { options {
@ -40,6 +55,10 @@ pipeline {
credentialsId: 'logos-press-engine-webhook-token', credentialsId: 'logos-press-engine-webhook-token',
variable: 'REVALIDATE_WEBHOOK_TOKEN' variable: 'REVALIDATE_WEBHOOK_TOKEN'
), ),
string(
credentialsId: 'logos-press-engine-strapi-api-key',
variable: 'STRAPI_API_KEY'
),
]) { ]) {
image = docker.build( image = docker.build(
"${IMAGE_NAME}:${GIT_COMMIT.take(8)}", "${IMAGE_NAME}:${GIT_COMMIT.take(8)}",
@ -47,6 +66,10 @@ pipeline {
"--build-arg='UNBODY_API_KEY=${env.UNBODY_API_KEY}'", "--build-arg='UNBODY_API_KEY=${env.UNBODY_API_KEY}'",
"--build-arg='SIMPLECAST_ACCESS_TOKEN=${SIMPLECAST_ACCESS_TOKEN}'", "--build-arg='SIMPLECAST_ACCESS_TOKEN=${SIMPLECAST_ACCESS_TOKEN}'",
"--build-arg='REVALIDATE_WEBHOOK_TOKEN=${REVALIDATE_WEBHOOK_TOKEN}'", "--build-arg='REVALIDATE_WEBHOOK_TOKEN=${REVALIDATE_WEBHOOK_TOKEN}'",
"--build-arg='STRAPI_API_URL=${params.STRAPI_API_URL}'",
"--build-arg='STRAPI_GRAPHQL_URL=${params.STRAPI_GRAPHQL_URL}'",
"--build-arg='NEXT_PUBLIC_ASSETS_BASE_URL=${params.NEXT_PUBLIC_ASSETS_BASE_URL}'",
"--build-arg='STRAPI_API_KEY=${STRAPI_API_KEY}'",
"."].join(' ') "."].join(' ')
) )
} }

View File

@ -19,6 +19,7 @@ type Metadata = {
contentType?: LPE.PostType contentType?: LPE.PostType
noIndex?: boolean noIndex?: boolean
rssFileName?: string rssFileName?: string
authors?: string[]
} }
const SITE_URL = getWebsiteUrl() const SITE_URL = getWebsiteUrl()
@ -38,6 +39,7 @@ export default function SEO({
contentType, contentType,
noIndex = false, noIndex = false,
rssFileName, rssFileName,
authors,
}: Metadata) { }: Metadata) {
const title = const title =
_title && _title.length _title && _title.length
@ -53,6 +55,7 @@ export default function SEO({
contentType, contentType,
date, date,
pagePath, pagePath,
authors,
}) })
return ( return (

View File

@ -31,6 +31,7 @@ export default async function handler(request: NextRequest) {
const alt = searchParams.get('alt') || '' const alt = searchParams.get('alt') || ''
const pagePath = searchParams.get('pagePath') || 'press.logos.co' const pagePath = searchParams.get('pagePath') || 'press.logos.co'
const date = searchParams.get('date') const date = searchParams.get('date')
const authors = searchParams.get('authors')
const imgSrc = image const imgSrc = image
const hasImage = !!imgSrc?.length const hasImage = !!imgSrc?.length
@ -44,7 +45,7 @@ export default async function handler(request: NextRequest) {
const isArticle = contentType === 'article' const isArticle = contentType === 'article'
const titleFontSize = isArticle && hasImage ? '54px' : '64px' const titleFontSize = isArticle && hasImage ? '54px' : '64px'
const subtitleFontSize = isArticle && hasImage ? '32px' : '36px' const subtitleFontSize = isArticle && hasImage ? '26px' : '32px'
const subtitleGap = isArticle && hasImage ? '16px' : '24px' const subtitleGap = isArticle && hasImage ? '16px' : '24px'
const subtitleMargin = isArticle && hasImage ? '24px' : '40px' const subtitleMargin = isArticle && hasImage ? '24px' : '40px'
@ -139,13 +140,13 @@ export default async function handler(request: NextRequest) {
style={{ style={{
display: 'flex', display: 'flex',
fontFamily: 'Lora', fontFamily: 'Lora',
fontSize: '40px', fontSize: '26px',
whiteSpace: 'pre-wrap', whiteSpace: 'pre-wrap',
textTransform: 'uppercase', textTransform: 'uppercase',
paddingLeft: '13px', paddingLeft: '3px',
}} }}
> >
<span>{siteConfigs.title.replace('Logos ', '')}</span> <span>{siteConfigs.title}</span>
</div> </div>
)} )}
</div> </div>
@ -181,8 +182,10 @@ export default async function handler(request: NextRequest) {
}} }}
> >
<span> <span>
{contentType ?? {contentType === 'article' && authors
pagePath.replace(/^\/+/, '').replace(/\/+/, ' | ')} ? `By ${authors}`
: contentType ??
pagePath.replace(/^\/+/, '').replace(/\/+/, ' | ')}
</span> </span>
{date && <span></span>} {date && <span></span>}
{date && <span>{`${day} ${month} ${year}`}</span>} {date && <span>{`${day} ${month} ${year}`}</span>}

View File

@ -28,6 +28,7 @@ const ArticlePage = ({ data, errors, why }: ArticleProps) => {
...data.data.authors.map((author) => author.name), ...data.data.authors.map((author) => author.name),
]} ]}
contentType={LPE.PostTypes.Article} contentType={LPE.PostTypes.Article}
authors={data.data.authors.map((author) => author.name)}
/> />
<ArticleContainer data={data} /> <ArticleContainer data={data} />
</> </>

View File

@ -7,12 +7,14 @@ export const getOpenGraphImageUrl = ({
contentType, contentType,
date, date,
pagePath, pagePath,
authors,
}: { }: {
title?: string | null title?: string | null
imageUrl?: string | null imageUrl?: string | null
contentType?: LPE.PostType | null contentType?: LPE.PostType | null
date?: string | null date?: string | null
pagePath?: string | null pagePath?: string | null
authors?: string[] | null
}) => { }) => {
const url = new URL('/api/og', getWebsiteUrl()) const url = new URL('/api/og', getWebsiteUrl())
const searchParams = new URLSearchParams() const searchParams = new URLSearchParams()
@ -22,6 +24,7 @@ export const getOpenGraphImageUrl = ({
contentType && searchParams.set('contentType', contentType) contentType && searchParams.set('contentType', contentType)
date && searchParams.set('date', date || '') date && searchParams.set('date', date || '')
pagePath && searchParams.set('pagePath', pagePath || '') pagePath && searchParams.set('pagePath', pagePath || '')
authors && searchParams.set('authors', authors.join(', ') || '')
url.searchParams.set('q', encodeURIComponent(searchParams.toString())) url.searchParams.set('q', encodeURIComponent(searchParams.toString()))