更改维基帖子的样式

A quick guide to change the style of your wiki posts:

更改背景颜色:

在您的 /admin/customize/themes 中,将以下 CSS 添加到 Common -> CSS 下方

.wiki .topic-body .cooked {
  background-color: #dcffdc; /*light green*/
}

更改文本大小

如果您愿意,也可以更改使用的字体或文本的大小,甚至是颜色

.wiki .topic-body .cooked p {
  font-size: 18px;
  color: green;
}

添加文本

您可以添加一段文本,向用户明确他们看到的是一篇 wiki 帖子

.post-info.edits .wiki::before {
  content: "EDIT THIS WIKI POST";
  color: green;
  background-color: #d2e2d2;
  margin-right: 3px;
  font-weight: bold;
  border: 1px solid green;
  padding: 3px;
}


This document is version controlled - suggest changes on github

22 个赞

Hey, we just changed the background color of wikis on the Fairphone forum, but like all other posts each wiki starts out as staff-blue when you load it, then slowly turns white and only then turns green.
Is there a way to disable this animation for wiki posts?

I believe this should do the trick:

.wiki .topic-body {animation: none;}

6 个赞

Here’s a Theme Component which makes Wikified posts pale green again, and incorporates @Kris’s animation: none tweak. (I chose an essentially random pale green as I did this surreptitiously while I was supposed to be paying attention in a meeting. But you can change the RGB value in the Theme Component CSS after installation)

Improvements always welcome by pull request.

4 个赞

有没有办法根据浅色或深色主题设置背景?期待您的回复。

1 个赞

最简单的方法是创建两个不同的主题组件,一个用于浅色主题,另一个用于深色主题,这样您就不需要再编写任何 CSS 了。

2 个赞

为了使 Wiki 自定义在私聊中配合新变更正常工作,我建议对 CSS 稍作调整,使其针对 .cooked 类:

// 自定义 Wiki 帖子
.wiki .topic-body .cooked {
    background-color: #e8f9fd;
    animation: none;
}
.post-info.edits .wiki::before {
    content: "Wiki Post";
    margin-right: 5px;
    font-weight: bold;
}

我也会将其添加到原始帖子(OP)中。


稍后……
出于好玩,我将其制作成了主题组件,并支持自定义背景色和文本。

2 个赞