Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3915 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit

I dont see number 4. code

Related Posts Odpovědi Zobrazení Aktivita
0
led 24
887
2
pro 24
2901
1
led 24
1697
1
kvě 25
2343
1
dub 25
3379