# ピン留めされたトピックをより目立たせる

**URL:** https://meta.discourse.org/t/highlight-pinned-topics-better/102355
**Category:** UX
**Created:** [2018 年 11 月 20 日午前 2:14 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355 "2018-11-20T02:14:19Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Json\_Blob](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/json_blob/32/119534_2.png) [@Json\_Blob](https://meta.discourse.org/u/Json_Blob)
#### Post date: [2018 年 11 月 20 日午前 2:14 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/1 "2018-11-20T02:14:19Z")

</div>

Hello

I run a discourse forum for my cycling team. And I find that pinned topics don’t really stand out much. I naturally find myself looking for some seperation or divider, bold titles on the threads, highlighting… something.

Currently aside from the little pin icon, they look exactly like standard topics which I find a little lack-luster.

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/5/e5561c48d274b37b225ec66c24cf1aac6db9b791.png)

Note the top two topics are pinned, but they’re listed just like everything else. I’d love to see simply a good, heavy divider between pinned topics and everything else but I’m open to other ideas. I just feel like right now they blend in to the mix and don’t call attention to themselves at all once they’re “read”.

Thoughts?

---

<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: [2018 年 11 月 20 日午前 4:07 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/2 "2018-11-20T04:07:14Z")

</div>

You can certainly apply whatever CSS you like to make that so via admin, customize.

---

<div class="post-metadata">

### Author: ![Json\_Blob](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/json_blob/32/119534_2.png) [@Json\_Blob](https://meta.discourse.org/u/Json_Blob)
#### Post date: [2018 年 11 月 20 日午前 6:20 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/3 "2018-11-20T06:20:44Z")

</div>

Ah ok, i’ll have to do some homework then on CSS because it’s not my strength.

Thanks for the direction 🙂

---

<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: [2018 年 11 月 20 日午前 10:27 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/4 "2018-11-20T10:27:54Z")

</div>

To highlight pinned topics on the latest page just add in your `/admin/customize/themes`:

```css
.topic-list-item.pinned {
    background: #ffffc9;
}

```

You can of course customize with CSS the pinned topics as you prefer once you know the class to use

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/6/2606d511c9f6168327d162dea69aacc79c93dd03.png)

---

<div class="post-metadata">

### Author: ![loginerror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loginerror/32/156605_2.png) [@loginerror](https://meta.discourse.org/u/loginerror)
#### Post date: [2019 年 4 月 17 日午後 12:41 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/5 "2019-04-17T12:41:10Z")

</div>

カテゴリ表示（カテゴリと最新に設定）で表示されるピン留めトピックを同様に実現するにはどうすればよいでしょうか？

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/b/cb8d37a4d480bfcbf82a61e4dc6309154895d3ea.png)

---

<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 年 4 月 17 日午後 2:15 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/6 "2019-04-17T14:15:26Z")

</div>

There is no status class (`.pinned`) in this case. To target a pinned topic you need to use the `id`, eg

```CSS
[data-topic-id="8"] {
    background: #ffffc9;
}

```

The CSS above target the topic globally everywhere, on `/latest`, on `/categories` and on topic, see:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/f/4f97047960568897c4532ff9542cd458b8558087.png)  
 ![image](https://global.discourse-cdn.com/meta/original/3X/1/2/1257378996f0d194ca6ab1bf65a88e8f14f43a42.png)  
 ![image](https://global.discourse-cdn.com/meta/original/3X/a/7/a7e4f3938ddf7ef22b40a1319f72c3dc78f2c261.png)

To target only the categories + latest page you need to add the appropriate class

```plaintext
.navigation-categories.categories-list [data-topic-id="8"] {
    background: #ffffc9;
}

```

In this way the topic will be highlighted only on that page.

PS: to find the topic ID the simplest way is to open the dev console on your browser with F12:

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

---

<div class="post-metadata">

### Author: ![loginerror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loginerror/32/156605_2.png) [@loginerror](https://meta.discourse.org/u/loginerror)
#### Post date: [2019 年 4 月 17 日午後 2:26 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/7 "2019-04-17T14:26:14Z")

</div>

@dax さん、ありがとうございます。なかなか良い解決策ですね。ただ、ピン留めされたトピックの更新が比較的早いため、少し不便に感じられる部分もあります。

---

<div class="post-metadata">

### Author: ![Sentinelrv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sentinelrv/32/64330_2.png) [@Sentinelrv](https://meta.discourse.org/u/Sentinelrv)
#### Post date: [2019 年 8 月 6 日午前 3:36 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/8 "2019-08-06T03:36:42Z")

</div>

> [@dax](#):
>
> カテゴリーと最新ページのみにターゲットを絞るには、適切なクラスを追加する必要があります。
> 
> ```plaintext
> .navigation-categories.categories-list [data-topic-id="8"] {
> background: #ffffc9;
> }
> 
> ```

こんにちは、これを試してみたのですが、何か問題があるようです。私が得た結果は以下の通りです…

 ![ThreadHighlight](https://global.discourse-cdn.com/meta/original/3X/7/b/7b11342970a1bef6521d701397a4cf16d364ee42.png)

スレッドのタイトルが隠されてしまう理由について、何か心当たりはありますか？

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2019 年 8 月 6 日午前 4:01 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/9 "2019-08-06T04:01:43Z")

</div>

タイトルに多くのパディングを追加して、クリック領域を大きくしているためです。この値を少し調整して、以下の CSS でオーバーラップを回避できます。

```css
.topic-list .main-link a.title {
    padding: 6px 0;
}

```

---

<div class="post-metadata">

### Author: ![Sentinelrv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sentinelrv/32/64330_2.png) [@Sentinelrv](https://meta.discourse.org/u/Sentinelrv)
#### Post date: [2019 年 8 月 9 日午前 2:07 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/10 "2019-08-09T02:07:23Z")

</div>

こんにちは、クリスさん。そのコードを追加しようと試みたのですが、特に変化が見られませんでした…

 ![CSS](https://global.discourse-cdn.com/meta/original/3X/e/e/ee551c69e3de2ac4fabcc4d93a14ff0fb70d2ce4.png)

もしかして、何か見落としているのでしょうか？数値を変更してみましたが、それもうまくいきませんでした。

---

<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 年 8 月 9 日午前 9:31 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/11 "2019-08-09T09:31:28Z")

</div>

そのサイトおよび特定のトピックへのリンクがあると便利です。

---

<div class="post-metadata">

### Author: ![Sentinelrv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sentinelrv/32/64330_2.png) [@Sentinelrv](https://meta.discourse.org/u/Sentinelrv)
#### Post date: [2019 年 8 月 11 日午前 2:54 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/12 "2019-08-11T02:54:21Z")

</div>

問題のトピックはこちら…

> **[DONATE to the Peercoin Exchange Listing Fund - Let’s Expand Access to Peercoin!](https://talk.peercoin.net/t/donate-to-the-peercoin-exchange-listing-fund-let-s-expand-access-to-peercoin/9582)**
>
> Exchange Expansion Many of you in the community have been asking for a while now what we have been doing to get Peercoin listed on more exchanges. Lack of access to more exchanges with high trading volume has been one of Peercoin’s biggest problem...

---

<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 年 8 月 12 日午前 10:40 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/13 "2019-08-12T10:40:02Z")

</div>

以下をお試しください：

```css

.latest-topic-list-item .main-link a.title {
    padding: 6px 0;
}

```

---

<div class="post-metadata">

### Author: ![Sentinelrv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sentinelrv/32/64330_2.png) [@Sentinelrv](https://meta.discourse.org/u/Sentinelrv)
#### Post date: [2019 年 8 月 19 日午後 2:40 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/14 "2019-08-19T14:40:27Z")

</div>

@dax それで少なくともデスクトップのカテゴリ表示ではうまくいったようです。ただし、モバイルのカテゴリ表示ではまだそのようになっています…

 ![photo_2019-08-19_10-36-36](https://global.discourse-cdn.com/meta/original/3X/0/2/02ee1273b3bb88180c91e664bf7fcc1938c7a2fb.jpeg)

また、最新の表示でも動作させることは可能でしょうか？現状ではカテゴリ表示でのみ機能しています。

---

<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 年 8 月 19 日午後 4:59 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/15 "2019-08-19T16:59:15Z")

</div>

以下でお試しください

```css
.mobile-view .topic-list .main-link a.title {
    padding: 3px 0;
}

```

> [@Sentinelrv](#):
>
> また、最新ビューでも動作させる方法はありますか？現時点ではカテゴリビューでのみ動作しています。

こちらをご覧になりましたか？

> [@Highlight pinned topics better](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/6?u=dax):
>
> There is no status class (.pinned) in this case. To target a pinned topic you need to use the id, eg [data-topic-id="8"] { background: #ffffc9; } The CSS above target the topic globally everywhere, on /latest, on /categories and on topic, see: [image] [image] To target only the categories + latest page you need to add the appropriate class .navigation-categories.categories-list [data-topic-id="8"] { background: #ffffc9; } In this way the topic will be highlighted only on…

以下も追加する必要があります

```css
[data-topic-id="9582"] {
    background: #fffff0;
}

```

---

<div class="post-metadata">

### Author: ![Sentinelrv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sentinelrv/32/64330_2.png) [@Sentinelrv](https://meta.discourse.org/u/Sentinelrv)
#### Post date: [2019 年 8 月 19 日午後 5:45 UTC](https://meta.discourse.org/t/highlight-pinned-topics-better/102355/16 "2019-08-19T17:45:11Z")

</div>

> [@dax](#):
>
> こちらをお読みになりましたか？

はい、読みましたが、すべての投稿を含むスレッド全体がハイライトされるのはあまり好ましくありませんでした。カテゴリと最新の表示ではトピックタイトルのみをハイライトし、スレッド自体はハイライトしたくなかったのです。他に方法がないのであれば、そうします。

ところで、そのモバイル用のコードで問題が解決したようです。
