Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize: Add instructions for changing fonts #605

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/customize/look-and-feel/font.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Change the font

You might also be wondering: *How do I change the font so I can make my instance adopt my institution's theme?*
There are different ways to add fonts to your InvenioRDM instance. You can either include Google Fonts by adding a link or add fonts locally. In this guide, we'll cover the steps to add fonts locally.

## Step-by-step

### 1. Add the font files

In your instance's `assets/less/site/fonts` directory, add the font files you want to use. For example, if you want to use the "Figtree" and "Open Sans" fonts, you would add the following files:

```bash
./assets/less/site/fonts/Figtree.woff2
./assets/less/site/fonts/OpenSans.ttf
```

### 2. Define the font faces

In `assets/less/site/globals/site.overrides` add the following code to define the font faces:

```less
@font-face {
font-family: "Figtree";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("../fonts/Figtree-Regular.woff2") format("woff2");
}

@font-face {
font-family: "Open Sans";
font-optical-sizing: auto;
font-style: normal;
font-weight: 400;
src: url("../fonts/OpenSans.ttf") format("truetype");
}

```

### 3. Use the fonts in your site

To use the fonts in your site, you can use the following in your `assets/less/site/globals/site.variables`:

``` less
/* Fonts */
@fontName: "Figtree", Arial, Helvetica, sans-serif;
@pageFont: "Open Sans", Arial, Helvetica, sans-serif;
@headerFont: @fontName;
```

### 4. Build the assets

After making the changes, build the assets by running the following command:

```bash
invenio-cli assets build -d
```

> **Note**: When you add the fonts while using `invenio-cli assets watch`, you need to cancel the process, build assets and start the watch again to avoid any issues.

After following these steps, your InvenioRDM instance should now use the specified fonts, reflecting your institution's theme.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ nav:
- Change logo: "customize/look-and-feel/logo.md"
- Change templates: "customize/look-and-feel/templates.md"
- Change theme: "customize/look-and-feel/theme.md"
- Change font: "customize/look-and-feel/font.md"
- Authentication: "customize/authentication.md"
- Sending emails: "customize/emails.md"
- Search:
Expand Down
Loading