# Discourseカスタマイズ

**URL:** https://forum.ficusonline.com/t/topic/35
**Category:** WEB Design
**Created:** [2016 年 10 月 12 日午後 11:34 UTC](https://forum.ficusonline.com/t/topic/35 "2016-10-12T23:34:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2016 年 10 月 12 日午後 11:34 UTC](https://forum.ficusonline.com/t/topic/35/1 "2016-10-12T23:34:20Z")

</div>

![](https://forum.ficusonline.com/uploads/default/original/1X/8650fc6fc61fb10219f97707b6ac9029ca6d3705.png)

```
<div id="bottom-navbar" class="wrap" style="height:20px; padding-top:15px; padding-bottom:30px;">
<span id="bottom-navbar-links">
  <a href="http://ficus.myvnc.com">ホーム</a> | 
  <a href="http://ficus.myvnc.com/ja/info/news">ニュース</a> | 
  <a href="http://ficus.myvnc.com/ja/blog">ブログ</a> | 
  <a href="https://ficus.myvnc.com/store">ストア</a>
</span>
</div>

```

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2020 年 4 月 7 日午前 7:23 UTC](https://forum.ficusonline.com/t/topic/35/2 "2020-04-07T07:23:23Z")

</div>

**highlight.js** を導入してコード記述箇所を色分けします。

**注）** インストールする前に以下設定をしないとブランクページとなります。

```auto
設定--->設定項目を検索--->"theme_authorized_extensions"を入力
"css"を追加します。

```

> **[Codeblockテーマピッカー](https://meta.discourse.org/t/codeblock-theme-picker/146396)**
>
> :discourse2: Summary Codeblock Theme Picker will allow you to easily change the theme used in code blocks. 👓 Preview Preview on Discourse Theme Creator 🛠 Repository Link https://github.com/discourse/hljs-theme-picker 📖 New to Discourse...

**Hljs Theme Picker cssカスタマイズ**

"Edit CSS/HTML"をクリック

 ![hljs_theme](https://forum.ficusonline.com/uploads/default/original/1X/2c830149e9eb0904182600cf94d1e5ffd3e01318.png)  
以下のブロックを追加し、 **padding** を **1.25em** で指定します。

```auto
.hljs {
    padding: 1.25em !important;
}

```

**注）** テーマをアップデートすると上記設定はリセットされます。

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2020 年 10 月 25 日午後 3:26 UTC](https://forum.ficusonline.com/t/topic/35/3 "2020-10-25T15:26:39Z")

</div>

### Brand Header Theme Component

> **[Brand Header](https://meta.discourse.org/t/brand-header/77977)**
>
> :discourse2: Summary Brand Header adds an extra top header for branding with your logo, navigation links, and social icons for both mobile and desktop views. Brand logo can be an image or text. 👓 Preview Preview on Discourse Theme Creator 🛠...

以下 **Font Awsome** によるアイコンリンクには **fab-** を付加すること。

> **[Font Awesome](https://fontawesome.com/icons?d=gallery)**
>
> The internet's icon library + toolkit. Used by millions of designers, devs, & content creators. Open-source. Always free. Always awesome.

```
icons
    fab-twitter,https://twitter.com/Ficus_Online_ST
    fab-github,http://github.com/capitalfuse

```

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2022 年 8 月 20 日午前 1:11 UTC](https://forum.ficusonline.com/t/topic/35/5 "2022-08-20T01:11:35Z")

</div>

## トピック・記事のサイトへの埋め込み

> **[Embedding a list of Discourse Topics in another site](https://meta.discourse.org/t/embedding-a-list-of-discourse-topics-in-another-site/125911)**
>
> If you grab the latest builds of Discourse you’ll get a the ability to embed topic lists in other sites via some simple Javascript and HTML. The typical use case for this is a blog or other content driven site, where you want a widget on the side...

### 最新トピック（投稿）のリスト表示

以下をウェブページへ記述

```auto
<script src="https://forum.ficusonline.com/javascripts/embed-topics.js"></script>
            <d-topics-list discourse-url="https://forum.ficusonline.com" template="complete" per-page="4"></d-topics-list>

```

オプション

```auto
`template`: Either `complete` or `basic` (default). While basic is just a list of topic titles, the complete complete brings title, user name, user avatar, created at date, and topic thumbnail.

`per-page`: Number. Controls how many topics to return.

`category`: Number. Restrict topics to a single category. Pass the `id` of the target category

`allow-create`: Boolean. If enabled the embed will have a “New Topic” button.

`tags`: String. Restrict topics to ones associated with this tag.

`top_period`: One of `all, yearly, quarterly, monthly, weekly, daily`. If enabled will return the “Top” topics of the period.

```

スタイルシートは `discouse` の管理ページで指定

 ![Screenshot from 2022-09-13 19-54-16](https://forum.ficusonline.com/uploads/default/original/2X/7/7ff34d7b81862214205bc6d7898596548612ac51.png)

```auto
:root {
    background: transparent;
}

.topic-list-item, tr {
    border-bottom: none;
}

.topics-list .topic-list-item .topic-column-wrapper {
    display: flex;
    flex-direction: column;
}

.topics-list {
    width: 95%;
}

.topics-list .topic-list-item .main-link {
    border-bottom: 1pxsolidvar(--primary-low);
    padding: 0.5rem;
    width: 100%;
    border-bottom: none;
}

.topics-list .topic-list-item .topic-column-wrapper .topic-column.details-column {
    flex-direction: column;
    width: 100%;
}

.topics-list .topic-list-item .topic-column-wrapper .topic-column.featured-image-column .topic-featured-image img {
    max-width: 100%;
    max-height: none;
}

.topics-list .topic-list-item .main-link a {
    color: #dee2e6;
}

.topics-list .topic-list-item .main-link a:visited {
    color: #dee2e6;
}

span.topic-author-username {
    color: #bdbdbd;
    font-size: xx-small;
}

.topics-list .topic-list-item .topic-column-wrapper .topic-column.details-column .topic-last-posted-at, .topics-list .topic-list-item .topic-column-wrapper .topic-column.details-column .topic-created-at, .topics-list .topic-list-item .topic-column-wrapper .topic-column.details-column .topic-stats {
    color: var(--primary-medium);
    font-size: small;
}

```

### Content Security Policy対応

埋め込み先のサイトドメインの登録が必要です。登録しないとスクリプトの実行が拒否されます。  
`Admin > Customize > Embedding`

> **[Embedding a list of Discourse Topics in another site](https://meta.discourse.org/t/embedding-a-list-of-discourse-topics-in-another-site/125911/120?u=takanobu_fuse)**
>
> Most likely related to this change: (cc @falco) Do you have your main site registered under Admin \> Customize \> Embedding?

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2023 年 7 月 25 日午前 7:34 UTC](https://forum.ficusonline.com/t/topic/35/6 "2023-07-25T07:34:48Z")

</div>

## ドメイン変更

> **[Change the domain name or rename your Discourse](https://meta.discourse.org/t/change-the-domain-name-or-rename-your-discourse/16098)**
>
> 🔖 This guide explains how-to change the domain name of your Discourse site, and includes information about setting up DNS changes, editing configuration files, updating site settings, and correcting social logins and post content to reflect your...

### Remove old domain name from any site settings

Visit `/admin/site_settings` and query for any settings that contain the old site name.

### Edit Discourse site name in app.yml

> 📣 Alternatively, you can run `./discourse-setup` again and input the new domain information instead of editing `app.yml`.

Edit the hostname line in `app.yml`

From the root directory where you installed Discourse you can run the follow to edit your `app.yml` file

```auto
$ cd /var/discourse
$ sudo nano containers/app.yml

```

Then find and edit:

```auto
## The domain name this Discourse instance will respond to
DISCOURSE_HOSTNAME: 'talk.bar.com'

```

(Also, if you are using a CDN, **turn it off now** by commenting out that line in the `app.yml`. You can turn it back on later.)

After the change, rebuild:

```auto
$ sudo ./launcher rebuild app

```

Once you do this, your site will only respond to the new domain name.

### Replace all instances of the old name with the new name in posts

All the existing posts will still refer to the old domain. Let’s fix that:

BEFORE

AFTER

```auto
$ sudo ./launcher enter app

```

then

```auto
# discourse remap talk.foo.com talk.bar.com

```

(If you don’t have discourse binary, you can use the rake version: `bundle exec rake posts:remap["talk.foo.com", "talk.bar.com"]`)

answer its paranoia prompt, and finally

```auto
# rake posts:rebake

```

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2023 年 10 月 11 日午後 1:35 UTC](https://forum.ficusonline.com/t/topic/35/7 "2023-10-11T13:35:01Z")

</div>

# [Discourse Advertising](https://meta.discourse.org/t/discourse-advertising/33734)

[https://github.com/discourse/discourse-adplugin](https://github.com/discourse/discourse-adplugin)

### Google Adsense

> **[Google AdSense - ウェブサイトを収益化](https://adsense.google.com/start/)**
>
> 広告とコンテンツの収益化によって、ウェブサイトで収益を獲得しましょう。ウェブサイト向けに AdSense の利用をすぐに開始する方法についてご確認ください。

> ### What if the ads.txt file is hosted on a subdomain? サブドメインの指定について

> **[ads.txt に関するよくある質問 - Google AdSense ヘルプ](https://support.google.com/adsense/answer/9785052?sjid=15990070512041132814-AP#zippy=%2Cwhat-if-the-adstxt-file-is-hosted-on-a-subdomain)**
>
> ads.txt に関するよくある質問とその答えをまとめました。 すべて開く  すべて閉じる WordPress 用の ads.txt ファイルを設定するにはどうすればよいですか？

Google crawls and enforces ads.txt files placed on subdomains, where one exists, and is referenced from the ads.txt file on the root domain.

To reference a subdomain in your root domain ads.txt file, you add a `subdomain=` declaration. For example, let’s say your ads.txt file for `example.com` needs to reference the subdomain `subdomain.example.com`. You’d add this line to your root domain ads.txt file: `subdomain=subdomain.example.com. `See the[IAB ads.txt specification](https://iabtechlab.com/ads-txt/) for additional details on subdomain referral.

**注）** サブドメインがルートドメインと同一のIDの場合には、必要のない処置です。

**Note** : You only need to do this if the authorized seller or your publisher ID are different for the subdomain when compared to the root domain.

### Amazon アソシエイト

> **[アソシエイト・セントラル](https://affiliate.amazon.co.jp/)**
