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 REVALIDATE_WEBHOOK_TOKEN
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 NEXT_TELEMETRY_DISABLED=1

23
Jenkinsfile vendored
View File

@ -7,6 +7,21 @@ pipeline {
defaultValue: params.IMAGE_TAG ?: '',
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 {
@ -40,6 +55,10 @@ pipeline {
credentialsId: 'logos-press-engine-webhook-token',
variable: 'REVALIDATE_WEBHOOK_TOKEN'
),
string(
credentialsId: 'logos-press-engine-strapi-api-key',
variable: 'STRAPI_API_KEY'
),
]) {
image = docker.build(
"${IMAGE_NAME}:${GIT_COMMIT.take(8)}",
@ -47,6 +66,10 @@ pipeline {
"--build-arg='UNBODY_API_KEY=${env.UNBODY_API_KEY}'",
"--build-arg='SIMPLECAST_ACCESS_TOKEN=${SIMPLECAST_ACCESS_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(' ')
)
}

View File

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

View File

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

View File

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

View File

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