有人在Discourse中添加自定义页脚了吗?

Hi everyone,

Props to whomever can help. Does anyone customized the footer of Discourse to include copyright text, links, etc.?

I am looking to do this for my site but honestly cannot figure out how to properly code the footer to where it looks and works good.

All help is appreciated, right now it feels like my Discourse site is “pantless”. :frowning:

Ours is just basic centered text so not much to help you with there. Do you have any kind of graphic mockup of what you’d like to achieve?

Just go to Admin, Customize, CSS/HTML, Bottom, and put your links in there :slight_smile:

Perhaps some fancy social media icons with text would work fine… I am checking http://codecanyon.net also in hopes of finding something potential to work with the site…

Thanks for your reply!

Cool. Once you figure out the HTML you need, adding it shouldn’t be too difficult using the steps @riking mentioned above.

Hi. I recently found the footers over at BootSnipp http://bootsnipp.com/tags/footer?page=1 and wanted to use one of these in my own Discourse forum. Bootsnipp separates HTML, CSS, Javascript - so it is easy to cut’n paste that code into the Customize sections of my Discourse.

I tried several but each one does not center on my Discourse. I thought there might be a conflict among generic tag names (like “row” or “container” - so I tried adding “footer-” to the front, but that did not help.)

There seem to be at least 2 issues:

  1. the centering doesn’t seem to work
  2. the CSS columns effect also does not work.

Is there a setting I can change in my Discourse Settings area to allow these effects to happen in the footer? Should I be using certain tag names?

I hope to add links to websites related to my forum down there. I may also try adding a banner zone like I used to have in our pre-Discourse days.

Here are a few examples

If you want to center your footer, either use flex to do it yourself, or use the “container” class.

2020 年查找此内容的更新说明

  1. 汉堡菜单 > 设置 > 自定义 > [选择主题] > “编辑 CSS/HTML”按钮 > 页脚
  2. 在框中输入您的自定义 HTML,然后点击“保存”。
  3. 为每个用户可选的主题重复上述步骤。

一个不错的版权基础部分

我使用了以下 HTML 作为我的版权页脚,我认为它既适用于默认浅色主题,也适用于深色主题:

<div style="text-align: center; color: #999; font-size: 90%; padding: 2em 0;">
Copyright &copy; 2020 在此插入您的公司名称。保留所有权利。
</div>

自动更新年份

当然,我不希望每 12 个月都要手动更改页脚中的年份,因此我将其升级为在页脚中包含以下 HTML:

<div style="text-align: center; color: #999; font-size: 90%; padding: 2em 0;">
Copyright &copy; <span id="footer-copyright-current-year"></span> 在此插入您的公司名称。保留所有权利。
</div>

并在 <body> 部分添加以下代码(可能不是最理想的代码,但我刚开始接触 Discourse 的修改):

<script>
    function setCopyrightYear() {
        var el = document.getElementById("footer-copyright-current-year");
        if (el) {
            el.innerHTML = new Date().getFullYear();
        } else {
            setTimeout(setCopyrightYear, 100);
        }
    }
    document.addEventListener("DOMContentLoaded", setCopyrightYear);
</script>

同样,您需要在希望显示此内容的每个主题中复制/粘贴上述代码。

有人刚刚告诉我,在他们的 Discourse 实例中,路径是:
汉堡菜单 > 管理 > 设置 > …

而在我们的实例(由 Discourse 托管)中,无需先进入“管理”界面。

哇……SmartThings 的这个主题真不错。你们在用哪个主题?我看到的这个自定义头部是自带的吗?

Open Energy Modelling Initiative我们的论坛 上使用了自定义页脚,其中包含我们的许可条款以及指向其他服务的可点击链接:

openmod-forum-footer-tight.screenshot-20210224t074253z

我认为这非常有用,并且在法律背景下也很有意义。

当然,我们在注册时也会征求对这些许可条款的同意