Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3946 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona

I dont see number 4. code

Post correlati Risposte Visualizzazioni Attività
0
gen 24
892
2
dic 24
2915
1
gen 24
1706
1
mag 25
2397
1
apr 25
3424