Custom route not being indexed/appearing in crawler view

Continued from: Creating Routes in Discourse and Showing Data

Sorry for necro posting, but this seems to be relevant place to ask…
After following this and other tutorials about creating a route and showing data

I replicated this for a non admin /snack a page, and it works, and it shows my data perfectly!
So it looks something like this:

...</header>

<h1>donut</h1>

<hr>

<p>delicious!</p>

<footer>...

But i just realized, this page is not indexed, crawled, sitemapped, seo’ed etc etc anywhere, and apparently its because discourse pages have a non js, “crawler view” versions…

So… after following the above tutorial, Where to go from here to show the same data on a “crawler view”, non js version of that page?

Right now non js version looks like this:

image

...</header>

empty

<footer>...

It says “empty” with an actual text… that is because it loads default empty.html.erb, right? How to make it show our { name: "donut", description: "delicious!" } instead? :slight_smile:

Tried some stuff from google, but nothing useful…
Stuff like… respond_to do… and format.html… and format.json…
And different kinds of render plain, text, html…
Nothing…

:frowning:

Separate .html.erb template for non js view maybe?
How to name it? Where to place it? How to get { name: "donut", description: "delicious!" } to it?

:frowning:

Help :grinning:

I don’t know. But you definitely need a non js template. What happens if you visit the page with javascript off?

1 Like

It shows the usual non js page… header… footer…

But thats as expected, since every tutorial only covers how to feed json data to a ember template…

1 Like

JavaScript only pages are not crawled afair.

You might want to take a look at something I was working on:

1 Like

Why are you showing me that? ^^
I was asking about the Creating Routes in Discourse and Showing Data tutorial…
I followed it
I have a route
I have data: { name: "donut", description: "delicious!" }
The route reads json and shows that data

How to get that same data, to the crawler page?

How does another version of static page plugin helps me with that? ^^ There is a number of static page plugins out there, mostly dead and abandoned. So… yay… another one…

I found a topic with the same question, How to transfer data from plugin to app/views templates?
And noone helped him either ^^
And it seems the guy solution was to stop using discourse ^^

Is that the only “real” solution? :slight_smile:

It’s a plugin for Discourse which ultimately renders back-end templates which are exposed to crawlers and have their own routes, that’s the reason. Perhaps you could:

  1. use it
  2. adapt it for your needs?

Thinking about it, you’re best to check out the vanilla plugin, without the extensions:

But as you please.

1 Like

So you clearly know how to do it…
Cant you just show how to do it? ^^

Like “to make donut delicious! appear on crawler page too, add this tiny line of code to this specific file”…
Done…

Or its illegal to help here? ^^
If its too complex or hackish and needs 20 new files created with hundreds and hundreds lines of unreadable garbage code, then sure, might be reasonable to go with alternative solutions… ^^

Hi @MrBug :slight_smile:

I’m sorry you’re not getting the answers you were hoping for, but after reviewing this topic the tone of your posts has become increasingly out of character with what we expect here on meta. If you’d like to continue participating could you please remember to have some respect for those who are contributing their time and effort to help people with their issues.

I’m going to close this topic off now.

3 Likes