# 去除页面源码中 noscript 部分的用户链接

**URL:** <https://meta.discourse.org/t/stripping-user-profile-links-from-noscript-section-of-page-source/276002>\
**Category:** Development\
**Created:** [2023 年8 月 21 日 10:35 UTC](https://meta.discourse.org/t/stripping-user-profile-links-from-noscript-section-of-page-source/276002 "2023-08-21T10:35:26Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![boltronics](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/boltronics/32/122375_2.png) [@boltronics](https://meta.discourse.org/u/boltronics)\
发布日期： [2023 年8 月 21 日 10:35 UTC](https://meta.discourse.org/t/stripping-user-profile-links-from-noscript-section-of-page-source/276002/1 "2023-08-21T10:35:26Z")

</div>

你好！

我需要对多个页面的 `<noscript></noscript>` 部分进行一些更改，以防止 Google 能够看到用户论坛链接的存在。例如，在 `topics/show.html.erb` 视图中的 [此处](https://github.com/discourse/discourse/blob/2a49757f35b1f503624cc2cfc44b01d8ba45519c/app/views/topics/show.html.erb#L57)。

我正在尝试找出实现此目的的最佳方法，但我想我需要通过插件覆盖整个视图（所有需要更改的地方）。我一直在尝试这种方法和其他方法（使用 `NO_EMBER_CLI=1 bundle exec rails s` 在本地运行 Rails 并使用浏览器的“查看源代码”功能），但我就是无法成功覆盖这些模板。

也许这里有人知道实现此目的的诀窍？也许是一行神奇的代码？😃 [此](https://github.com/scossar/feature-phone-first/blob/master/plugin.rb) 示例看起来应该能实现我的目标，但不幸的是已经过时了。这是一个改编版本：

```plaintext
# name: no_profiles_when_indexing
# about: Prevent indexing from even knowing that profile pages exist
# version: 0.1

after_initialize do
  ApplicationController.class_eval do
    def set_layout
      File.expand_path('../app/views/topics/show.html.erb', __FILE__ )
    end
  end
end

```

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/a/d/4adc1d8644983e5f5fbb526914ab6c9560f244c5.png)

我实际上不是 Ruby 开发者，所以任何提示或建议都将不胜感激。谢谢。

---

_[View the full topic](https://meta.discourse.org/t/stripping-user-profile-links-from-noscript-section-of-page-source/276002)._
