Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

OG metadata

default discord avatar
parfenovx12 years ago
9

Hi Payload Community! Please, could somebody explain, how can I update og meta tags like title,description, image for a root page? I successfully updated it for every page, but when I’m sharing my website with just base route it is showing default Payload properties like : Payload E-Commerce Template, An open-source e-commerce store…


I deleted all mentions of this locally but it is still displaying on link preview.



Here is visual example, just so that it is clear, this is the same page I try to share, but if there is no /home , default properties for OG tags are used. I’ve set custom properties for pages on admin dashboard, but how can I set them for base route sharing?

  • default discord avatar
    0815sauce2 years ago

    You can Change it in the seo Field (backend) there is a option for images, description and Open-Graph Image

  • default discord avatar
    parfenovx12 years ago

    Thank you for your response. As I said, I’ve change these fields for every page, but this is not working for the root website link. Is there any global configs for these fields, not for a specific page?

  • default discord avatar
    0815sauce2 years ago

    It will work, Payload 67 and the seo Plugin. This is the Home (Start) Page

  • default discord avatar
    parfenovx12 years ago

    In this case I’m talking more about OG meta tags that are used for social network sharing

  • default discord avatar
    0815sauce2 years ago

    You can add this Manuel in the Layout.tsx file



    I have in the Showcase section also a Working Dynamic Sitemap.ts for website and Posts



    And dont forgot the Robot.txt



    Here is a Working dynamic sitemap.xml for payload v3 with posts!



    import { MetadataRoute } from 'next'
    
    const serverUrl = 'https://your-url.com'
    
    export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
      const { docs: posts } = await fetch(`${serverUrl}/api/posts?limit=0`).then((res) =>
        res.json(),
      )
    
      const sitemap: MetadataRoute.Sitemap = []
    
      for (const post of posts) {
        sitemap.push({
          changeFrequency: 'weekly',
          lastModified: post.updatedAt,
          priority: 1,
          url: `${serverUrl}/posts/${post.slug}`,
        })
      }
    
      return [
        ...sitemap,
        {
          url: 'https://your-url.com',
          lastModified: new Date(),
          changeFrequency: 'weekly',
          priority: 1,
        },
        
      ]
    }
  • default discord avatar
    parfenovx12 years ago

    I just need to modify OG meta tags for social network sharing, that’s all. Like in this example, I’m sharing the same website, moreover, it is same page. But for first message I just shared a base link, and for the second one I added /home . So how to make sure this is also updated for the base url? I’ve added manually meta tags to Head section of a base layout.tsx, but it is still display default values

  • default discord avatar
    0815sauce2 years ago

    This is only with the seo Plugin in Payload. Social Sharing Homepage





    Sharing in WhatsApp



    Only the Plugin in Payload and its work



    That will also work with /home



    Did you find the Problem?

  • discord user avatar
    seanzubrickas
    2 years ago

    Hey

    @287996619125948417

    you'll find the Meta for that in

    src/app/_utilities/mergeOpenGraph.ts



    If you have a

    /home

    page however, the Meta for that page

    should

    override the defaults above

  • default discord avatar
    parfenovx12 years ago

    Yeah, thank you guys. It is working now. I set /home to be default initial route. Now there is another issue when sharing specific page. In example below I’m sharing product page link, title and description is coming from product seo fields, but image is not. It displays image that was set in seo field for the whole products page, not the specific product from this page



    https://homeware.payloadcms.app/products/phone
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.