• I have a cpt, which is not being indexed.

    The CPT is marked to be indexed and the number of indexed pages is correct and includes the CPT pages.

    The debugging shows the title of the post, but the function “What does the post look like in the database” gives an empty result.

    how is the output producted? By using an FSE Theme, the CPT has an own Template and the content is generated by a block in this template. (Not the standard-content-block, is is a self-written block).

    In the frontend, everything looks fine but relevanssi cannot index the content.

    Any ideas?

    Best regards.

    WordPress Version 6.4.3
    Relevanssi Version 4.22.1


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Relevanssi doesn’t see the template. It only sees the post content. If all the post content happens in the template, Relevanssi never sees it.

    What you need is a filter function on the relevanssi_content_to_index hook that compiles the post content Relevanssi needs to see for the post and presents it to Relevanssi. Perhaps you can use the block rendering function there, or you can access the post content in some other fashion; I can’t go into details as I don’t know anything about your case.

    Thread Starter casper99

    (@casper99)

    I assumed that Relevanssi indexes the fully rendered page regardless of which block produces the output. So, only the content outputted by the standard content block of Gutenberg is indexed? This is a standard feature of WordPress, right? That you can even use custom templates for CPT via the backend in FSE themes.

    Thread Starter casper99

    (@casper99)

    To make it clear. It is not an template.php file like in old wordpress themes. It is an Full-Site-Editing Template, which uses multiple blocks for the output. One block is the standard-gutenberg-content-block. Other Blocks also output text. But relevanssi sees nothing.

    Plugin Author Mikko Saari

    (@msaari)

    Still, if the content is not in the post content, Relevanssi doesn’t see it. Relevanssi is over ten years old, and when it was created, FSE didn’t exist. I’m unfamiliar with it myself, so I don’t really know how it works when the post content is stored in the template.

    But looking at how it’s done, I’m guessing a solution would be to use the relevanssi_post_content hook instead. This hook filters the post content. Add a filter function on this hook on priority 9 or earlier and have that function figure out the template used and replace the post content with the post_content field of the template. That should do the trick, because then on priority 10 in the same hook, Relevanssi renders the blocks.

    This way, Relevanssi would see the post content from the template instead of the empty post content from the original post.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CPT Content is not indexed’ is closed to new replies.