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

TD-19 Add favicon customization docs #204

Merged
merged 1 commit into from
Dec 7, 2024
Merged
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
82 changes: 82 additions & 0 deletions src/content/docs/customization/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,88 @@ markup such as:
<img src="<%= #{AppConfig[:frontend_proxy_prefix]} %>assets/my_logo.png" alt="My logo" />
</div>

## Customizing the favicon

A favicon is an icon associated with a web page that browser and operating systems display (ie: in a browser's address bar or tab, next to the web page name in a bookmark list, etc.).

### Default images

The ArchivesSpace favicons are stored in the top-level `public/` directory of the frontend and public applications.

1. `frontend/public/favicon-AS.png`
2. `frontend/public/favicon-AS.svg`
3. `public/public/favicon-AS.png`
4. `public/public/favicon-AS.svg`

### Markup

Favicon markup is found in each application's favicon partial template:

1. `frontend/app/views/site/\_favicon.html.erb`
2. `public/app/views/shared/\_favicon.html.erb`

### Configuration

Favicons are shown by default via the configuration options in `config.rb` (or `common/config/config-defaults.rb` in development). Set the respective option to `false` to not show a favicon.

```rb
# config.rb
AppConfig[:pui_show_favicon] = true # whether or not to show a favicon
AppConfig[:frontend_show_favicon] = true # whether or not to show a favicon
```

### Plugin examples

Replace the default favicon with your own via a plugin.

:::caution[Reserved favicon filenames]
Custom favicon files must be named something other than `favicon-AS.png` and `favicon-AS.svg` in order to override the default favicon.
:::

#### Frontend

The frontend plugin should have the following directory structure:

```
plugins/local/frontend/
├── assets
│   ├── favicon.png
│   └── favicon.svg
└── views
└── site
└── _favicon.html.erb
```

The frontend favicon template should look something like:

```erb
<!-- plugins/local/frontend/views/site/_favicon.html.erb -->
<link rel="icon" type="image/png" href="<%= AppConfig[:frontend_proxy_prefix] %>assets/favicon.png">
<link rel="icon" type="text/svg+xml" href="<%= AppConfig[:frontend_proxy_prefix] %>assets/favicon.svg">
```

#### Public

The public plugin should have the following directory structure:

```
plugins/local/public/
├── assets
│   ├── favicon.png
│   └── favicon.svg
└── views
└── shared
└── _favicon.html.erb
```

The public favicon template should look something like:

```erb
<!-- plugins/local/public/views/shared/_favicon.html.erb -->
<link rel="icon" type="image/png" href="<%= asset_path('favicon.png', skip_pipeline: true) %>">
<link rel="icon" type="image/svg+xml" href="<%= asset_path('favicon.svg', skip_pipeline: true) %>">
```

## Plugin configuration

Plugins can optionally contain a configuration file at `plugins/[plugin-name]/config.yml`.
Expand Down
Loading