# Font Awesome 5 と SVG アイコンの紹介

**URL:** https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643
**Category:** Announcements
**Tags:** new-feature
**Created:** [2018 年 11 月 9 日午前 12:55 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643 "2018-11-09T00:55:16Z")
**Posts on this page:** 20
**Page:** 4

<div class="post-metadata">

### Author: ![jimmyfc23](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimmyfc23/32/124031_2.png) [@jimmyfc23](https://meta.discourse.org/u/jimmyfc23)
#### Post date: [2019 年 1 月 19 日午前 6:18 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/62 "2019-01-19T06:18:12Z")

</div>

Just thought I’d post how I got these working with html after reading closely through the thread. (I would say in future to let everyone know in the original thread about the new system settings to get icons going on headers etc).

To add some icons go to `/admin/site_settings/category/all_results?filter=icons` and add the prefixes accordingly. “Add additional FontAwesome 5 icons that you would like to include in your assets. Use prefix ‘fa-’ for solid icons, ‘far-’ for regular icons and ‘fab-’ for brand icons.”

Eg `fa-newspaper`.

Then reference them in your html. Eg `<svg class="fa d-icon d-icon-newspaper svg-icon svg-node" aria-hidden="true"><use xlink:href="#newspaper"></use></svg>`.

---

<div class="post-metadata">

### Author: ![Mark\_Schmucker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_schmucker/32/124810_2.png) [@Mark\_Schmucker](https://meta.discourse.org/u/Mark_Schmucker)
#### Post date: [2019 年 1 月 21 日午前 8:43 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/63 "2019-01-21T08:43:27Z")

</div>

> [@tshenry](#):
>
> Hey @LKNickname, try this out:
> 
> ```plaintext
> const { iconNode } = require("discourse-common/lib/icon-library");
> api.decorateWidget("header-icons:before", helper => {
> return helper.h("li", [
> helper.h(
> "a#globe-button.icon",
> {
> href: "https://www.website.com/",
> title: "Back to website"
> },
> iconNode("globe")
> )
> ]);
> });
> 
> ```

That worked so well I’d like to add a second button. I naively tried:

```
<script type="text/discourse-plugin" version="0.4">
const { iconNode } = require("discourse-common/lib/icon-library");
api.decorateWidget('header-icons:before', helper => {
    return helper.h('li',
      [
        helper.h('a#home-button.icon', {
            href:'https://docs.google.com/spreadsheets',
            title: 'Spreadsheet'
        }, iconNode('table')),
        helper.h('a#home-button.icon', {
            href:'https://google.com',
            title: 'Google'
        }, iconNode('globe')),
      ]
    );
});
</script>

```

But that gave a weird alignment:

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/a/8a8aae8b268c78d5ed8ca363425a3205bf460715.png)

How can I make the globe vertically aligned with the rest of the buttons?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [2019 年 1 月 21 日午前 8:50 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/64 "2019-01-21T08:50:43Z")

</div>

There is a well-maintained theme component to use that is already updated to works with FA5 and that add more than 1 button before the header icons:

> [@Custom Header Links (icons)](https://meta.discourse.org/t/iconified-header-links/86307):
>
> discourse2Summary Custom Header Links (icons) will allow you to easily add linked icons to the Discourse header.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/custom-header-links-icons)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-icon-header-links](https://github.com/discourse/discourse-icon-header-links)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features Screenshots Desktop Mobile Settings This component includes a …

---

<div class="post-metadata">

### Author: ![TerminalAddict](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terminaladdict/32/119676_2.png) [@TerminalAddict](https://meta.discourse.org/u/TerminalAddict)
#### Post date: [2019 年 2 月 3 日午後 8:11 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/65 "2019-02-03T20:11:56Z")

</div>

Can I have some help?  
I have previous registered a couple of extra icons:

```
api.decorateWidget('header-icons:before', helper => {
    return [
        helper.h('li', [
            helper.h('a#home-button.icon', {
                href: '/',
                title: 'McRides Home'
            }, helper.h('i.fa.fa-home.home-button-icon.d-icon')),
        ]),
                helper.h('li', [
            helper.h('a#weather-button.icon', {
                href: 'https://www.mcrides.co.nz/t/weather-forecast/77',
                title: 'Weather Forecast'
            }, helper.h('i.fa.fa-cloud.weather-button-icon.d-icon')),
        ])
    ];
});

```

I can see in this thread how I would redo this (or I’m not that skilled 🙂 probably this )

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [2019 年 2 月 3 日午後 9:16 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/66 "2019-02-03T21:16:36Z")

</div>

The theme component introduced just before will help you do it really easily

> [@Custom Header Links (icons)](https://meta.discourse.org/t/iconified-header-links/86307):
>
> discourse2Summary Custom Header Links (icons) will allow you to easily add linked icons to the Discourse header.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/custom-header-links-icons)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-icon-header-links](https://github.com/discourse/discourse-icon-header-links)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features Screenshots Desktop Mobile Settings This component includes a …

But if you really want to do it manually, the first post of this #howto will help

> [@(Superseded) Add new link on header beside search icon](https://meta.discourse.org/t/add-new-link-on-header-beside-search-icon/48621):
>
> mega This feature is now available as a [dedicated theme component](https://meta.discourse.org/t/iconified-header-links/86307). Want to add a new link right next to search icon on header? Follow below steps: Add this JavaScript code to your site theme Go to Admin Customize Themes Select the theme you wish to customize Edit CSS/HTML \</head\> \<script type="text/discourse-plugin" version="0.4"\> const { iconNode } = require("discourse-common/lib/icon-library"); api.decorateWidget('header-icons:before', helper =\> { return helper.h('li', [ he…

---

<div class="post-metadata">

### Author: ![TerminalAddict](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terminaladdict/32/119676_2.png) [@TerminalAddict](https://meta.discourse.org/u/TerminalAddict)
#### Post date: [2019 年 2 月 4 日午前 1:21 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/67 "2019-02-04T01:21:13Z")

</div>

how do i  
add the icon to the `svg icon subset` site setting

Here’s what I’ve got:

```
api.decorateWidget('header-icons:before', helper => {
    return [
        helper.h('li', [
            helper.h('a#home-button.icon', {
                href: '/',
                title: 'McRides Home'
            }, iconNode('home')),
        ]),
        helper.h('li', [
            helper.h('a#weather-button.icon', {
                href: 'https://www.mcrides.co.nz/t/weather-forecast/77',
                title: 'Weather Forecast'
            }, iconNode('cloud-sun')),
        ])
    ];
});

```

the home icon works, the cloud-sun (I also tried cloud) doesn’t

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [2019 年 2 月 4 日午前 1:58 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/68 "2019-02-04T01:58:35Z")

</div>

Search for the setting svg icon and type the name of the icon with the right prefix

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/4/643cca93a72f4825f7505c00abf3da317efc8b53.png)

`fa-cloud` or `fa-cloud-sun` and it should work after a refresh of the page

---

<div class="post-metadata">

### Author: ![meetdilip](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@meetdilip](https://meta.discourse.org/u/meetdilip)
#### Post date: [2019 年 2 月 4 日午前 5:16 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/69 "2019-02-04T05:16:45Z")

</div>

Does this mean that Discourse still ships with Font Awesome even though it uses SVG icons ?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019 年 2 月 4 日午前 5:45 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/70 "2019-02-04T05:45:47Z")

</div>

Font Awesome is itself SVG in V5

---

<div class="post-metadata">

### Author: ![meetdilip](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@meetdilip](https://meta.discourse.org/u/meetdilip)
#### Post date: [2019 年 2 月 4 日午前 6:03 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/71 "2019-02-04T06:03:03Z")

</div>

So v 2.2 does come with FA pre loaded ? I thought you skipped it for its size.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2019 年 2 月 4 日午前 6:44 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/72 "2019-02-04T06:44:47Z")

</div>

> [@Discourse Version 2.2](https://meta.discourse.org/t/discourse-version-2-2/95438/4):
>
> Update Font Awesome to v5.4.1 and SVGs (#6557)

You should check our release topic to know more about included features in version 2.2. Also the [blog post](https://blog.discourse.org/2019/02/discourse-2-2-released/).

---

<div class="post-metadata">

### Author: ![meetdilip](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@meetdilip](https://meta.discourse.org/u/meetdilip)
#### Post date: [2019 年 2 月 4 日午前 7:41 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/73 "2019-02-04T07:41:15Z")

</div>

I read it. It says about dropping the font icon.

> We’ve also fully converted to SVG icons **instead of relying on a font icon. This is more efficient than shipping a giant and mostly unused icon font**. Plus, it’s now much easier to switch _any_ visible icon in Discourse with something else, even a completely custom one-off glyph that you created.
> 
> ![using SVG glyphs to replace icons in Discourse 2.2](https://global.discourse-cdn.com/meta/original/3X/0/8/089faade6b89c9048277ece7cef1814aa46b5fda.png)
> 
> Prefer to use your custom logo instead of the default like heart? Make it so!

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2019 年 2 月 4 日午前 7:52 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/74 "2019-02-04T07:52:08Z")

</div>

Yes, we moved to SVG icons instead of fonts. But that doesn’t mean we skipped Font Awesome 😉.

> [@codinghorror](#):
>
> Font Awesome is itself SVG in V5

---

<div class="post-metadata">

### Author: ![meetdilip](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@meetdilip](https://meta.discourse.org/u/meetdilip)
#### Post date: [2019 年 2 月 4 日午前 8:07 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/75 "2019-02-04T08:07:57Z")

</div>

I see. So you are using FA as SVG images ? I never knew we can extract them individually.

---

<div class="post-metadata">

### Author: ![TerminalAddict](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terminaladdict/32/119676_2.png) [@TerminalAddict](https://meta.discourse.org/u/TerminalAddict)
#### Post date: [2019 年 2 月 4 日午後 11:33 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/76 "2019-02-04T23:33:11Z")

</div>

Thanks !  
I didn’t even know it was there 🙂

---

<div class="post-metadata">

### Author: ![Chi\_Duc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chi_duc/32/125171_2.png) [@Chi\_Duc](https://meta.discourse.org/u/Chi_Duc)
#### Post date: [2019 年 2 月 12 日午前 9:07 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/77 "2019-02-12T09:07:15Z")

</div>

Anybody can help?  
I need to replace this code to svg:  
`<i class="fa fa-long-arrow-left" aria-hidden="true"></i>`  
Thank you so much!

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [2019 年 2 月 12 日午前 9:27 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/78 "2019-02-12T09:27:29Z")

</div>

That specific icon has been removed from the list of free font awesome icons. The closest equivalent is `long-arrow-alt-left`. If you are limited to using HTML, you would use:

```plaintext
<svg class="fa d-icon d-icon-long-arrow-alt-left svg-icon svg-node" aria-hidden="true">
  <use xlink:href="#long-arrow-alt-left"></use>
</svg>

```

You will also need to add `long-arrow-alt-left` to the `svg icon subset` site setting.

---

<div class="post-metadata">

### Author: ![Chi\_Duc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chi_duc/32/125171_2.png) [@Chi\_Duc](https://meta.discourse.org/u/Chi_Duc)
#### Post date: [2019 年 2 月 12 日午前 9:49 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/79 "2019-02-12T09:49:51Z")

</div>

Thanks @tshenry  
You are so awesome 😄  
I tried to use `long-arrow-alt-left`, it worked well.  
But can you tell me more if I still want to use `long-arrow-left`.

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [2019 年 2 月 12 日午前 9:58 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/80 "2019-02-12T09:58:00Z")

</div>

> [@Chi\_Duc](#):
>
> But can you tell me more if I still want to use `long-arrow-left` .

Unfortunately, as I mentioned above, that icon is not available in the free tier of Font Awesome icons. If `long-arrow-alt-left` will not work for you, I think your best option might be to create your own version and use a plugin as [described in the post above](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/61).

---

<div class="post-metadata">

### Author: ![Chi\_Duc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chi_duc/32/125171_2.png) [@Chi\_Duc](https://meta.discourse.org/u/Chi_Duc)
#### Post date: [2019 年 2 月 12 日午前 10:17 UTC](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643/81 "2019-02-12T10:17:15Z")

</div>

oh, I see 😂  
Thanks @tshenry so much!

[Previous page](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643.md?page=3)

[Next page](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643.md?page=5)
