Skip to Content
Menu
This question has been flagged

Ive looked through a few posts but i have no idea where the fonts folder is for odoo or where the css section is on the website builder to add a custom font to the header.

Can someone provide me with a (step by step tutorial) or video? on how to add a local font to the website? Thank you very much for your time.

Avatar
Discard
Best Answer

Hi

To add a local font to the header of your Odoo website builder, you'll need to follow these steps:

1. Prepare the Font Files: Obtain the font files (.woff, .woff2, .ttf) for the font you want to use and place them in a directory within your Odoo project, such as `my_module/static/fonts/`.

2. Create a CSS file: In the same module directory, create a new CSS file (e.g., `custom_styles.css`) and add the following CSS code:

   ```

   @font-face {

     font-family: 'CustomFont';

     src: url('/my_module/static/fonts/your_font_file.woff') format('woff'),

          url('/my_module/static/fonts/your_font_file.woff2') format('woff2'),

          url('/my_module/static/fonts/your_font_file.ttf') format('truetype');

   }

   ```

Replace `'CustomFont'` with the desired font name and `'your_font_file'` with the actual name of your font file.

3. Import the CSS file: Open your module's manifest file and add the CSS file to the website assets:


   ```

   {

       'name': 'My Module',

       'version': '1.0',

       'depends': ['website'],

       'data': [

           'views/assets.xml',

       ],

       'installable': True,

   }

   ```


4. Create the assets.xml file: In your module's `views` folder, create a new XML file named `assets.xml` and add the following code:


   ```

   ```

Adjust the paths to match your module structure.

5. Update the module list: Restart your Odoo server or update the module list to load the changes.

Once you have added the local font to your Odoo website using the steps mentioned, the font will be available in the website builder. You can then use the font within the website builder to customize the appearance of elements such as the header, text blocks, or any other section of your website.

NB:  The instructions may vary depending on your Odoo version and setup.


Hope it helps

Avatar
Discard

I dont see number 4. code

Related Posts Replies Views Activity
0
Jan 24
884
2
Dec 24
2899
1
Jan 24
1696
1
May 25
2329
1
Apr 25
3368