# 如何将数据从插件传递到应用/视图模板？

**URL:** <https://meta.discourse.org/t/how-to-transfer-data-from-plugin-to-app-views-templates/81528>\
**Category:** Development\
**Created:** [2018 年2 月 26 日 10:05 UTC](https://meta.discourse.org/t/how-to-transfer-data-from-plugin-to-app-views-templates/81528 "2018-02-26T10:05:21Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![Stranik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stranik/32/85638_2.png) [@Stranik](https://meta.discourse.org/u/Stranik)\
发布日期： [2018 年2 月 26 日 10:05 UTC](https://meta.discourse.org/t/how-to-transfer-data-from-plugin-to-app-views-templates/81528/1 "2018-02-26T10:05:21Z")

</div>

1. I created a test page using the plugin help

By placing the following code in the appropriate files.  
For example, in plugin.rb

```
Discourse::Application.routes.append do
  get '/help' => 'discourse_help/help#my_page'
end

load File.expand_path('../lib/dev/engine.rb', __FILE__ )

```

engine.rb

```
module DiscourseHelp
  class Engine < ::Rails::Engine
    isolate_namespace DiscourseHelp

    config.after_initialize do
		Discourse::Application.routes.append do
			mount ::DiscourseHelp::Engine, at: "/"
		end
    end
  end
end

```

Etc.

I can see this page very well in my browser. Nicely. Included the second browser did the User Agent as a search engine and looked at this page as it is seen by the robots (search engines).

Robots do not see the content of the page, but only see:

 ![%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%20%D0%BE%D1%82%202018-02-26%2013-00-48](https://global.discourse-cdn.com/meta/original/3X/7/9/79d7513a98dcbda4176c276159e694e874c7bbbd.png)

Perfectly. I then decided to check and put to check already working plugins (for example, static pages, which were offered here). The result is similar.

Search engines do not see the content of the pages they create. I. e., I cannot use such pages for search engines.

I would like to know what are the ways to pass plugin content to templates at: app/views

I beg forgiveness for my English, Google translator used.

* * *

Another example about which I wrote above.

[https://discourseleague.com/page/static-pages-plugin/1/](https://discourseleague.com/page/static-pages-plugin/1/)

 ![%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%20%D0%BE%D1%82%202018-02-26%2013-26-26](https://global.discourse-cdn.com/meta/original/3X/3/3/33656e0efbda628f43e268d7cd8b9876c8f034f6.png)

Etc. This is a general trend …

---

_[View the full topic](https://meta.discourse.org/t/how-to-transfer-data-from-plugin-to-app-views-templates/81528)._
