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.

Changing Meta Title

default discord avatar
ayandajrlast year
4

Good day



I am struggling to change the title of my e-commerce application from "Payload E-Commerce Template" to "<My custom name>. Normally in NextJs, we would find this on the "Layout.tsx" page where we would then change the title then description of the site. Upon looking at the "Layout.tsx" file under the src/app folder I was not able to find the "Title" and "Description" options.



Is it possible to receive direction on where I would be able to change the title?



Kind Regards,


Ayanda Vilakazi


Junior Full Stack Developer

  • discord user avatar
    alessiogr
    last year

    Hello! You can find it in here:

    https://github.com/payloadcms/payload/blob/main/templates/ecommerce/src/payload/seed/home-static.ts#L27


    The contents of the homepage are not hard-coded -

    all content

    comes from payload, including the "Payload E-Commerce Template" title.



    By default, if you do not have a home-page set up inside of Payload, it will use the home-static file as data for the homepage

  • default discord avatar
    ayandajrlast year

    okay thank you so much

  • discord user avatar
    alessiogr
    last year

    You're welcome!



    For extra clarity, also check out this file:

    https://github.com/payloadcms/payload/blob/main/templates/ecommerce/src/app/(pages)/%5Bslug%5D/page.tsx

    That is the page Next.JS loads when you open your website. You can see in line 22, the slug is set to 'home' by default.



    Then in line 43, it uses the home-static.ts data as data for the page if no slug with name 'home' is found in payload.



    And finally, it returns the

    <Hero

    and

    <Blocks

    components, which basically render the data dynamically



    That's probably the logic you were looking for - it's not in the

    layout.tsx

    , but in

    (pages)/[slug]/page.tsx
  • default discord avatar
    ayandajrlast year

    thank you so much for your help!!

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.