Updating favicon

default discord avatar
augdust
last month
2

i'm trying to update the favicon for the admin UI without any luck - i'm probably just missing something obvious (have tried following the docs for white labeling on the payload website).



in my

server.ts

file I have added this line:

app.use('/assets', express.static(path.resolve(__dirname, './assets')));

and added an import for 'path' from 'path'.



in my payload.config I have added this meta-block to the admin object:


meta: {
  titleSuffix: '- Name for CMS',
  favicon: '/assets/favicon.svg'
}


The guide says I need to create a folder named 'assets' and put my images in there. It does however not specify where to put this folder - I have tried both in the root of the directory, and withing the

src

folder - both resulting in a 404 error trying to fetch the image.

  • default discord avatar
    trugamr
    4 weeks ago

    If you are using standalone payload app then this should do the job assuming you have assets folder in root of project.


    app.use('/assets', express.static(path.resolve('assets')));
  • default discord avatar
    augdust
    4 weeks ago

    this does not work in my application

    :think:



    I've got my 'assets'-folder at the root of my project, outside of the 'src'-folder.



    My admin.meta looks like this:



    meta: {
                titleSuffix: '- Site Name CMS',
                favicon: '/assets/favicon.svg'
            }


    And my server.ts har this line:

    app.use('/assets', express.static(path.resolve('assets')));



    In the browser I get a 404 error for the favicon, but if I visit the URL its trying to fetch from myself I can see the favicon just fine



    looks like it might have been a cache issue, resolved itself after a few more refreshes. thanks for the help :)

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.