セレクターなしでこのspanオブジェクトのテキストを変更する方法

This object has the following HTML:

<span>Topic</span>

I’m wondering how one might use css to change this text to something else, e.g. “Blogs”.

EDIT: I would want to do this on a per-category basis.

「いいね!」 1

This is customisable via /admin/customize/site_texts?q=Topics

I’m not sure exactly which one it is though…

You can figure it out by running I18n.enableVerboseLocalizationSession() in the JS console, reloading the page, then you’ll be able to correlate the number of the string with output in the console:

「いいね!」 2

This would be for all categories though, right? I want to do it per category.

「いいね!」 1

Hello :wave:

This is possible with CSS.

body.category-name {
  .topic-list-header {
    .default.topic-list-data {
      span {
        visibility: hidden;
        &:before {
          content: "Blogs";
          visibility: visible;
        }
      }
    }
  }
}
「いいね!」 2

I wish I could give you 10 likes! Thank you so much, Don!

「いいね!」 3

If you want to do this on multiple categories and avoid having many SCSS lines, you can use SCSS loops. It makes the code easier to read and maintain because you’ll just have to edit two SCSS variables.

「いいね!」 4

I’m going to try to make this into a theme plugin, thanks for this loop idea!

「いいね!」 4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.