Change the Site Logo
The site logo is one of the key elements of your site’s branding. In T-Doc Template, the logo is located in the assets
folder and can be customized easily. Follow the steps below to update your site logo.
Option 1: Modify the Template Instead
Instead of replacing the default logo.png
files, you can directly modify the navigation template to use your own inline SVG or a custom image tag.
Use a Custom Inline SVG
- Open the navigation template file:
templates/default/views/partials/navigation.mustache
- Locate the following block:
<a href="{{baseUrl}}/" class="logo"> <svg ...>...</svg> <span>{{site.name}}</span> </a>
- Replace the
<svg>
tag with your own custom inline SVG content.
Use a Custom
Tag
If you prefer using an image file instead of inline SVG:
- Replace the
<svg>
element with an image tag, like so:<picture> <source srcset="{{baseUrl}}/images/logos/logo~dark.png" media="(prefers-color-scheme: dark)" /> <img src="{{baseUrl}}/images/logos/logo.png" alt="Logo of {{site.name}}" title="{{site.name}}" /> </picture>
- Make sure the path matches your custom logo file and that it’s placed in the correct location.
- You may optionally add logic for dark mode by switching the image source via JavaScript or CSS.
Keep the
alt
attribute meaningful for better accessibility.
Option 2: Replace the Default Logo Files
- Navigate to the assets/images/logos/ directory in your project folder.
- By default, this folder contains two logo files::
- logo.png: The primary logo used across the site.
- logo~dark.png: A variation of the logo used in dark mode (if your site supports it).
- By default, this folder contains two logo files::
Step 1: Prepare Your Custom Logos
- Create Your Custom Logos:
- Use design software like Adobe Photoshop, Canva, or Figma to create your custom logos.
- Ensure the your logos align with your brand’s design.
- Recommended File Format:
- Use PNG format with a transparent background for best results.
- If you prefer other formats (e.g., SVG or JPG), ensure that your site supports them.
Step 2: Replace the Logo Files
- Rename your custom logos to match the default logo file names:
logo.png
(for the primary logo)logo~dark.png
(for the dark mode logo)
- Copy your custom logo files into the assets/images/logos/ directory.
- Overwrite the existing
logo.png
andlogo~dark.png
files.
- Overwrite the existing
Step 3: Regenerate the Site
After replacing the logo files, you need to regenerate your site for the changes to take effect:
- Open your terminal and navigate to your project directory.
- Run the following command:
toucan generate
- This command will process the updated assets and regenerate the site.
Step 4: Preview Your Changes
- Start the local development server to preview the updated site:
toucan serve
- Open your browser and navigate to http://localhost:3000.
- Verify that:
- The new logo is displayed on the site.
- The dark mode logo (if applicable) is displayed correctly.
Step 5: Troubleshooting
If the updated logo does not appear, check the following:
- File Naming: Ensure that your custom files are named exactly
logo.png
andlogo~dark.png
. - File Path: Confirm the files are located in assets/images/logos/.
- Cache: Clear your browser cache or use an incognito window to view the changes.