i am trying to save my Lexical richText field to a lexicalHTMLField inside a payload CMS Block, but my links are not rendered correctly. All internal links are just shown as <a href="#"></a>
I am trying to use the content on my next.js frontend (which is decoupled from payload and queries data over graphql)
In general i am not really sure what is the recommended way to handle this. i dont want to render the lexical content dynamically on the next.js frontend because of SEO reasons.
I tried multiple things including adding custom converters but i cannot get it running. the documentation is not very helpful either unfortunately
I tried to add a converter here, but nothing really works:
import type { Block } from 'payload'
import {
FixedToolbarFeature,
HeadingFeature,
InlineToolbarFeature,
lexicalEditor,
lexicalHTMLField
} from '@payloadcms/richtext-lexical'
import { LinkHTMLConverter } from '@payloadcms/richtext-lexical/html'
export const Content: Block = {
slug: 'content',
interfaceName: 'ContentBlock',
fields: [
{
name: 'richText',
type: 'richText',
localized: true,
editor: lexicalEditor({
features: ({ rootFeatures }) => {
return [
...rootFeatures,
HeadingFeature({ enabledHeadingSizes: ['h2', 'h3', 'h4'] }),
FixedToolbarFeature(),
InlineToolbarFeature(),
]
},
}),
label: false,
},
lexicalHTMLField({
htmlFieldName: 'richText_html',
lexicalFieldName: 'richText',
converters: ({ defaultConverters }) => ({
...defaultConverters,
// tried to add a custom converter here
}),
}),
],
}