Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve content editing features, enable preview and SEO #59

Merged
merged 53 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
240b580
update: convert to clickable link to author page
rccsousa Oct 16, 2024
e64c8c2
fix: change featured image container position to relative
rccsousa Oct 16, 2024
21df3dd
refactor Authors component and AuthorPills
rccsousa Oct 16, 2024
59fc434
convert single author pill to a clickable link
rccsousa Oct 16, 2024
80b2887
make highlighted content clicable and link to content
rccsousa Oct 16, 2024
510770a
fix: image container was rendering even without images
rccsousa Oct 16, 2024
3277067
fix: image container was rendering even without images
rccsousa Oct 16, 2024
f6e3b09
fix styling
rccsousa Oct 16, 2024
a4ead44
fix broken links
rccsousa Oct 16, 2024
51cefaa
make content card link hug featured image
rccsousa Oct 16, 2024
a12f616
file renaming
rccsousa Oct 17, 2024
ab706d2
update header styling
rccsousa Oct 17, 2024
14229ee
optimize css
rccsousa Oct 17, 2024
094e043
update: improve header dynamic style
rccsousa Oct 17, 2024
49e6049
update: add socials collection and include social links in footer
rccsousa Oct 17, 2024
aa58976
fix typescript errors
rccsousa Oct 17, 2024
112d35c
update metadata generation
rccsousa Oct 17, 2024
c9d27f0
improve editing optins - meta, SEO and previewing
rccsousa Oct 17, 2024
145a86c
update fetchers to enable draft version preview
rccsousa Oct 17, 2024
9194641
fix slug not generating properly upon author creation/edit
rccsousa Oct 17, 2024
3a475d7
improve clarity on author socials' fields
rccsousa Oct 17, 2024
c800709
re-enable author social links rendering for content pages
rccsousa Oct 17, 2024
8bac8a4
fix content card styling
rccsousa Oct 17, 2024
f48e8b5
remove character limit on about section
rccsousa Oct 17, 2024
131125e
fix: point to updated authorName field instead of name
rccsousa Oct 18, 2024
91f7ea3
enable SEO and live preview
rccsousa Oct 18, 2024
852df72
update: add paths to existing collections
rccsousa Oct 18, 2024
977886c
linting
rccsousa Oct 18, 2024
267b00e
delete unused collections
rccsousa Oct 18, 2024
7bc1ef6
remove link to deleted collections
rccsousa Oct 18, 2024
7b594c3
update payload config
rccsousa Oct 18, 2024
821b7cb
fix SEO plugin
rccsousa Oct 18, 2024
331f97d
regenerate types and import map
rccsousa Oct 18, 2024
68bd6f7
delete unused files and respective dependencies
rccsousa Oct 18, 2024
963c324
update generate meta to fetch images when using cloud storage
rccsousa Oct 18, 2024
95bfd5f
update metadata generation to make use of SEO plugin
rccsousa Oct 18, 2024
e59334a
add missing categories
rccsousa Oct 18, 2024
a83f349
cleaning
rccsousa Oct 18, 2024
75dd8e7
regenerate types
rccsousa Oct 18, 2024
90ef400
refactor AuthorPill
rccsousa Oct 18, 2024
bb65893
fix: refactor to reflect new authorpill changes
rccsousa Oct 18, 2024
180ec2a
fix conflicts and update author pill
rccsousa Oct 18, 2024
2c7d57b
linting
rccsousa Oct 18, 2024
bc5eee3
enforce category attribution
rccsousa Oct 21, 2024
6de2a24
remove unused categories
rccsousa Oct 21, 2024
098c5ad
enrich lexical features and improve visibility
rccsousa Oct 21, 2024
08aefd2
increase summary character limit to 1000
rccsousa Oct 21, 2024
11bc736
update heading font size enforcing
rccsousa Oct 21, 2024
d2001d6
Merge branch 'main' of https://github.com/subvisual/content-sub into …
rccsousa Oct 21, 2024
e62da43
regenerate payload types
rccsousa Oct 21, 2024
f5d9e19
delete unused blocks
rccsousa Oct 21, 2024
e224034
formating
rccsousa Oct 21, 2024
418e365
remake BeforeDashboard component
rccsousa Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/app/(pages)/authors/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Header } from "../../../_components/Header";
import { fetchContentBySlug } from "@/app/_utilities/contentFetchers";
import { Author } from "@/payload-types";
import { Metadata } from "next";
import { generateMeta } from "@/utilities/generateMeta";

export const dynamic = 'force-dynamic'

Expand Down Expand Up @@ -43,9 +44,7 @@ export async function generateMetadata({ params: paramsPromise}): Promise<Metada
slug: slug,
type: "authors",
})
// @ts-ignore
return generateMeta({doc: author})

return {
// @ts-ignore
title: `Subvisual | ${author.name}`
}
}
11 changes: 5 additions & 6 deletions src/app/(pages)/blogposts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { fetchContentBySlug } from "@/app/_utilities/contentFetchers";
import { Blogpost } from "@/payload-types";
import { Header } from "@/app/_components/Header";
import { Metadata } from "next";
import { generateMeta } from "@/utilities/generateMeta";

const headerStyle = {
'--dynamic-background': 'var(--sub-purple-400)',
Expand Down Expand Up @@ -58,7 +59,7 @@ export default async function BlogpostPage({ params: paramsPromise }) {
</div>
</div>
{// @ts-ignore
blogpost.relatedPosts?.length > 0 && <RelatedContent content={blogpost} />
blogpost.related?.length > 0 && <RelatedContent content={blogpost} />
}
<Subscribe />

Expand All @@ -68,13 +69,11 @@ export default async function BlogpostPage({ params: paramsPromise }) {

export async function generateMetadata({ params: paramsPromise}): Promise<Metadata> {
const { slug } = await paramsPromise
const blogpost = await fetchContentBySlug({
const post = await fetchContentBySlug({
slug: slug,
type: "blogposts",
})
// @ts-ignore
return generateMeta({doc: post})

return {
// @ts-ignore
title: `Subvisual | ${blogpost.title}`
}
}
14 changes: 14 additions & 0 deletions src/app/(pages)/case-studies/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//
// import { fetchDoc } from '../../../_api/fetchDoc'

import { Metadata } from "next";
import { fetchContentBySlug } from "@/app/_utilities/contentFetchers";
import { generateMeta } from "@/utilities/generateMeta";

export const dynamic = 'force-dynamic'

export default async function CaseStudiesPage() {
Expand All @@ -25,3 +29,13 @@ export default async function CaseStudiesPage() {
</div>
)
}

export async function generateMetadata({ params: paramsPromise}): Promise<Metadata> {
const { slug } = await paramsPromise
const caseStudy = await fetchContentBySlug({
slug: slug,
type: "podcasts",
})
// @ts-ignore
return generateMeta({doc: caseStudy})
}
14 changes: 6 additions & 8 deletions src/app/(pages)/podcasts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Subscribe } from '../../../_blocks/Subscribe'
import { Header } from '@/app/_components/Header'
import { fetchContentBySlug } from "@/app/_utilities/contentFetchers";
import { Metadata } from "next";
import { generateMeta } from "@/utilities/generateMeta";

export const dynamic = 'force-dynamic'

Expand All @@ -33,22 +34,19 @@ export default async function PodcastEpisodesPage({params: paramsPromise}) {
<Header style={headerStyle} />
<EpisodeHead episode={episode} />
<EpisodeContent episode={episode} />
<RelatedContent content={episode} />
{/* @ts-ignore */}
{episode.related?.length > 0 && <RelatedContent content={episode} />}
<Subscribe />
</div>
)
}

export async function generateMetadata({ params: paramsPromise}): Promise<Metadata> {
const { slug } = await paramsPromise
const podcast = await fetchContentBySlug({
const episode = await fetchContentBySlug({
slug: slug,
type: "podcasts",
})

return {
// @ts-ignore
title: `Subvisual | ${podcast.title}`,

}
// @ts-ignore
return generateMeta({doc: episode})
}
14 changes: 14 additions & 0 deletions src/app/(pages)/talks-and-roundtables/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
//
// import { fetchDoc } from '../../../_api/fetchDoc'

import { Metadata } from "next";
import { fetchContentBySlug } from "@/app/_utilities/contentFetchers";
import { generateMeta } from "@/utilities/generateMeta";

export const dynamic = 'force-dynamic'

export default async function TalksAndRoundTablesPage() {
Expand All @@ -25,3 +29,13 @@ export default async function TalksAndRoundTablesPage() {
</div>
)
}

export async function generateMetadata({ params: paramsPromise}): Promise<Metadata> {
const { slug } = await paramsPromise
const talk = await fetchContentBySlug({
slug: slug,
type: "talks-and-roundtables",
})
// @ts-ignore
return generateMeta({doc: talk})
}
42 changes: 20 additions & 22 deletions src/app/(payload)/admin/importMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { RichTextField as RichTextField_1 } from '@payloadcms/richtext-lexical/c
import { getGenerateComponentMap as getGenerateComponentMap_2 } from '@payloadcms/richtext-lexical/generateComponentMap'
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_3 } from '@payloadcms/richtext-lexical/client'
import { FixedToolbarFeatureClient as FixedToolbarFeatureClient_4 } from '@payloadcms/richtext-lexical/client'
import { HeadingFeatureClient as HeadingFeatureClient_5 } from '@payloadcms/richtext-lexical/client'
import { UnderlineFeatureClient as UnderlineFeatureClient_6 } from '@payloadcms/richtext-lexical/client'
import { BoldFeatureClient as BoldFeatureClient_7 } from '@payloadcms/richtext-lexical/client'
import { ItalicFeatureClient as ItalicFeatureClient_8 } from '@payloadcms/richtext-lexical/client'
import { LinkFeatureClient as LinkFeatureClient_9 } from '@payloadcms/richtext-lexical/client'
import { UnderlineFeatureClient as UnderlineFeatureClient_5 } from '@payloadcms/richtext-lexical/client'
import { BoldFeatureClient as BoldFeatureClient_6 } from '@payloadcms/richtext-lexical/client'
import { ItalicFeatureClient as ItalicFeatureClient_7 } from '@payloadcms/richtext-lexical/client'
import { LinkFeatureClient as LinkFeatureClient_8 } from '@payloadcms/richtext-lexical/client'
import { SlugComponent as SlugComponent_9 } from '@/fields/slug/SlugComponent'
import { OverviewComponent as OverviewComponent_10 } from '@payloadcms/plugin-seo/client'
import { MetaTitleComponent as MetaTitleComponent_11 } from '@payloadcms/plugin-seo/client'
import { MetaImageComponent as MetaImageComponent_12 } from '@payloadcms/plugin-seo/client'
import { MetaDescriptionComponent as MetaDescriptionComponent_13 } from '@payloadcms/plugin-seo/client'
import { PreviewComponent as PreviewComponent_14 } from '@payloadcms/plugin-seo/client'
import { SlugComponent as SlugComponent_15 } from '@/fields/slug/SlugComponent'
import { HorizontalRuleFeatureClient as HorizontalRuleFeatureClient_16 } from '@payloadcms/richtext-lexical/client'
import { BlocksFeatureClient as BlocksFeatureClient_17 } from '@payloadcms/richtext-lexical/client'
import { HorizontalRuleFeatureClient as HorizontalRuleFeatureClient_15 } from '@payloadcms/richtext-lexical/client'
import { BlocksFeatureClient as BlocksFeatureClient_16 } from '@payloadcms/richtext-lexical/client'
import { HeadingFeatureClient as HeadingFeatureClient_17 } from '@payloadcms/richtext-lexical/client'
import { UploadFeatureClient as UploadFeatureClient_18 } from '@payloadcms/richtext-lexical/client'
import { BlockquoteFeatureClient as BlockquoteFeatureClient_19 } from '@payloadcms/richtext-lexical/client'
import { RelationshipFeatureClient as RelationshipFeatureClient_20 } from '@payloadcms/richtext-lexical/client'
Expand All @@ -29,29 +29,28 @@ import { InlineCodeFeatureClient as InlineCodeFeatureClient_27 } from '@payloadc
import { SuperscriptFeatureClient as SuperscriptFeatureClient_28 } from '@payloadcms/richtext-lexical/client'
import { SubscriptFeatureClient as SubscriptFeatureClient_29 } from '@payloadcms/richtext-lexical/client'
import { StrikethroughFeatureClient as StrikethroughFeatureClient_30 } from '@payloadcms/richtext-lexical/client'
import { LinkToDoc as LinkToDoc_31 } from '@payloadcms/plugin-search/client'
import { default as default_32 } from '@/components/BeforeDashboard'
import { default as default_33 } from '@/components/BeforeLogin'
import { default as default_31 } from '@/components/BeforeDashboard'
import { default as default_32 } from '@/components/BeforeLogin'

export const importMap = {
"@payloadcms/richtext-lexical/client#RichTextCell": RichTextCell_0,
"@payloadcms/richtext-lexical/client#RichTextField": RichTextField_1,
"@payloadcms/richtext-lexical/generateComponentMap#getGenerateComponentMap": getGenerateComponentMap_2,
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_3,
"@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient": FixedToolbarFeatureClient_4,
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_5,
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_6,
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_7,
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_8,
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_9,
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_5,
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_6,
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_7,
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_8,
"@/fields/slug/SlugComponent#SlugComponent": SlugComponent_9,
"@payloadcms/plugin-seo/client#OverviewComponent": OverviewComponent_10,
"@payloadcms/plugin-seo/client#MetaTitleComponent": MetaTitleComponent_11,
"@payloadcms/plugin-seo/client#MetaImageComponent": MetaImageComponent_12,
"@payloadcms/plugin-seo/client#MetaDescriptionComponent": MetaDescriptionComponent_13,
"@payloadcms/plugin-seo/client#PreviewComponent": PreviewComponent_14,
"@/fields/slug/SlugComponent#SlugComponent": SlugComponent_15,
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_16,
"@payloadcms/richtext-lexical/client#BlocksFeatureClient": BlocksFeatureClient_17,
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_15,
"@payloadcms/richtext-lexical/client#BlocksFeatureClient": BlocksFeatureClient_16,
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_17,
"@payloadcms/richtext-lexical/client#UploadFeatureClient": UploadFeatureClient_18,
"@payloadcms/richtext-lexical/client#BlockquoteFeatureClient": BlockquoteFeatureClient_19,
"@payloadcms/richtext-lexical/client#RelationshipFeatureClient": RelationshipFeatureClient_20,
Expand All @@ -65,7 +64,6 @@ export const importMap = {
"@payloadcms/richtext-lexical/client#SuperscriptFeatureClient": SuperscriptFeatureClient_28,
"@payloadcms/richtext-lexical/client#SubscriptFeatureClient": SubscriptFeatureClient_29,
"@payloadcms/richtext-lexical/client#StrikethroughFeatureClient": StrikethroughFeatureClient_30,
"@payloadcms/plugin-search/client#LinkToDoc": LinkToDoc_31,
"@/components/BeforeDashboard#default": default_32,
"@/components/BeforeLogin#default": default_33
"@/components/BeforeDashboard#default": default_31,
"@/components/BeforeLogin#default": default_32
}
19 changes: 19 additions & 0 deletions src/app/(payload)/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.rich-text-lexical * {
max-width: 600px;
margin: 0 auto;
line-height: 2em;
}

.rich-text-lexical h1 {
font-size: var(--size-40);
}

.rich-text-lexical h2,
.rich-text-lexical h3,
.rich-text-lexical h4,
.rich-text-lexical h5,
.rich-text-lexical h6 {
font-size: var(--size-28);

}

6 changes: 2 additions & 4 deletions src/app/_blocks/AuthorContentGrid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ContentCard from "../../_components/ContentCard";
import { calculateTotalArticles } from "../../_utilities/calculateTotalArticles";
import styles from "./styles.module.css";

export default function AuthorContentGrid({content}) {
export default function AuthorContentGrid({ content }) {

return (
<div className={styles.gridContainer}>
Expand All @@ -18,9 +18,7 @@ export default function AuthorContentGrid({content}) {
<div className={styles.contentGrid}>
{Object.keys(content).map(key =>
content[key].map((contentPiece, i) => (
<div key={i} className={styles.contentCard}>
<ContentCard contentType={key} content={contentPiece} />
</div>
<ContentCard contentType={key} content={contentPiece} rounded/>
)),
)}
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/app/_blocks/BlogpostContent/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@

@media (min-width: 1024px) {

.content h1,
.content h1 {
font-size: var(--size-40);
}

.content h2,
.content h3,
.content h4,
Expand Down
7 changes: 4 additions & 3 deletions src/app/_blocks/EpisodeContent/Contributors/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { AuthorPill } from "@/app/_components/AuthorPill";

import SocialLinks from "@/app/_components/SocialLinks"
export default function Contributors({ className, authors }) {
return (
<div className={className}>
<p className={"outline"}>CONTRIBUTORS</p>
<p className={'outline'}>CONTRIBUTORS</p>
{authors.map((author, i) => (
<div>
{/* Author has to be passed as an Array for compatibility reasons */}
<AuthorPill authors={[author]} />
<SocialLinks socials={author.socials} />
</div>
))}
</div>
);
)
}
2 changes: 1 addition & 1 deletion src/app/_blocks/EpisodeContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function EpisodeContent({ episode }) {
<div className={styles.sharingAndCategories}>
<hr/>
<Share />
<Categories categories={categories} />
{categories && <Categories categories={categories} />}
<RSSFeed className={styles.RSSFeed} />
</div>
</div>
Expand Down
6 changes: 1 addition & 5 deletions src/app/_blocks/HubContentGrid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ export default function HubContentGrid({ content }) {
<div className={styles.contentGrid}>
{filteredContent.map((article, i) => (
<div className={styles.contentCard}>
<ContentCard

contentType={article.contentType}
content={article.content}
/>
<ContentCard contentType={article.contentType} content={article.content} rounded={false} />
</div>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/_blocks/HubHead/Highlights/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function Highlights({ content, main }) {
<div className={styles.metadataContainer}>

<span className={styles.categories}>
{categories.map((category, i) => <CategoryPill key={i} title={category.title} />)}
{categories && categories.map((category, i) => <CategoryPill key={i} title={category.title} />)}
</span>


Expand Down
7 changes: 3 additions & 4 deletions src/app/_blocks/RelatedContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styles from "./styles.module.css";
import ContentCard from "@/app/_components/ContentCard";

export function RelatedContent({ content }) {

return (
<div className={styles.container}>

Expand All @@ -19,10 +20,8 @@ export function RelatedContent({ content }) {
}}
>
{content.related.map((contentPiece, i) => (
<div key={i} className={styles.contentCard}>
<ContentCard contentType={"Blogposts"} content={contentPiece} />
<br />
<Link href={`${contentPiece.slug}`}>{contentPiece.title}</Link>
<div style={{width: '400px'}}>
<ContentCard contentType={"Blogposts"} content={contentPiece} rounded />
</div>
))}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/app/_components/AuthorSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import styles from "./styles.module.css";
import { Author } from "@/payload-types";

export default function AuthorSummary({ author }) {
const { name, role, bio, linkedIn, gitHub, medium, x, featuredImage } = author;
const { authorName, role, bio, linkedIn, gitHub, medium, x, featuredImage, socials } = author;

// TODO: Convert this to an array with names in collection config
const socials = [linkedIn, gitHub, medium, x].filter(Boolean);


return (
<div className={styles.gridContainer}>
Expand All @@ -20,7 +20,7 @@ export default function AuthorSummary({ author }) {
</div>
}
<div className={styles.authorInfo}>
<h5>{name}</h5>
<h5>{authorName}</h5>
<p>{role}</p>
<SocialLinks socials={socials} />
</div>
Expand Down
23 changes: 0 additions & 23 deletions src/app/_components/Authors/index.tsx

This file was deleted.

Loading
Loading