# Help wanted on plugin controller

**URL:** https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258
**Category:** Development
**Created:** [February 27, 2016, 11:05am UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258 "2016-02-27T11:05:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [February 27, 2016, 11:05am UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/1 "2016-02-27T11:05:05Z")

</div>

We’re building a Sitemap plugin and I’m running into an issue.

(Yes there has been a lot of discussion around the need for a sitemap, but Google News totally requires it)

Somehow the code in the controller is never executed and I get the regular “The page you requested doesn’t exist or is private” message.

Because I suspected an issue with the view, I have stripped the code so it should only output a log line and an error, but this doesn’t work either.

Code is here:  
[https://github.com/communiteq/discourse-sitemap/blob/master/plugin.rb#L20-L26](https://github.com/communiteq/discourse-sitemap/blob/master/plugin.rb#L20-L26)

Running it does this:

 ![](https://global.discourse-cdn.com/meta/original/3X/4/f/4f72c0cc9dd0696922522cfe66b4ef97804afb82.PNG)

If I rename the `generate` method or change the route, I get an error that the controller could not be found, so I should be on the right path here. Is there anyone who can spot (the probably very trivial) issue?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 29, 2016, 11:48am UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/2 "2016-02-29T11:48:56Z")

</div>

Why do you have two routes for `get "sitemap.xml"` ?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [February 29, 2016, 12:23pm UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/3 "2016-02-29T12:23:51Z")

</div>

I have now monkey patched robots\_txt to make it work, and commented out the part that references the engine.

[This is the commit](https://github.com/communiteq/discourse-sitemap/commit/f33c2accbdf24028a531fbe33860c84660dda6e7#diff-b61ae67bc6a57a3decb8d15b832077f4R20) you should be looking at

---

<div class="post-metadata">

### Author: ![EndruK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endruk/32/50211_2.png) [@EndruK](https://meta.discourse.org/u/EndruK)
#### Post date: [April 13, 2016, 1:39pm UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/4 "2016-04-13T13:39:14Z")

</div>

Did you get it to work?  
I got exactly the same problem, that my controller method code never gets called but the application knows the controller and his methods.

Regards

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 13, 2016, 3:22pm UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/5 "2016-04-13T15:22:25Z")

</div>

No, I was never able to get that fixed ☹

---

<div class="post-metadata">

### Author: ![EndruK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endruk/32/50211_2.png) [@EndruK](https://meta.discourse.org/u/EndruK)
#### Post date: [August 5, 2016, 8:36am UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/6 "2016-08-05T08:36:53Z")

</div>

You need a client route as equivalent for a server route  
[https://meta.discourse.org/t/custom-home-page-to-discourse/12329/2?u=endruk](https://meta.discourse.org/t/custom-home-page-to-discourse/12329/2)

And on the client you have to call the server controller:

> [@Plugin Controller Method never called](https://meta.discourse.org/t/plugin-controller-method-never-called/42815/15):
>
> I’m not sure you can display views through controllers without an Ember route map. The only time I’ve called Ruby controller methods is through ajax calls. Take a look at the plugin how-to and look at the section where Robin talks about the route map.

Hope this helps you 🙂

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [August 5, 2016, 9:42am UTC](https://meta.discourse.org/t/help-wanted-on-plugin-controller/40258/7 "2016-08-05T09:42:05Z")

</div>

robots.txt is requested by search engine bots, not by the user.  
So there is no need / use for an Ember route map…
