Add a get-option to enable noscript view of a page

If you watch a discourse forum with javascript disabled, you get a read-only view of that page.

could you add a link to the read-only view at the bottom? so you can for example print the whole page or translate it with google,…

also a functioning noscript view of a search result should be easy to implement with this option. At the moment it doesn’t work without js like this:
https://meta.discourse.org/search?q=something

1 Like

The patch should be added here:

https://github.com/discourse/discourse/blob/3620c8c85e034dc770c0311f35e902e87a857fe8/app/controllers/application_controller.rb#L54


Perhaps `params.key?(:noscript)

2 Likes

I changed the line to

def use_crawler_layout? 
  @use_crawler_layout ||= (has_escaped_fragment? || params.key?(:noscript) || CrawlerDetection.crawler?(request.user_agent))
end

And this seems to work, if I add ?noscript=1 to any site, I get the crawler-view, but the stylesheet is not included there, I guess there has to be changed somethhing in the layout too?

Why would you need this? Just set the user agent in your browser as required.

We could build an AMP view of the topic page for quick loading for first-time, anonymous visitors.

I guess you refer to Google Accelerated Mobile Pages, to accelerate content loading on mobile devices.
I think that’s another issue.

My point here is to make sites like Google translate work with discourse by adding a parameter not to use JavaScript.

Don’t see the point of amp, we already have html views, just beef them up and expose

Isn’t a beefed up HTML view and AMP basically the same thing? What got me excited about AMP was that it seemed like a good specification for a beefed up Discourse HTML front-end to target.

There is already a param for this: _escaped_fragment_ – just add it to any URL to get the crawlable version.

1 Like

But that’s also without stylesheet: Add a get-option to enable noscript view of a page?escaped_fragment

Try this instead: disable JavaScript and look at this page.
It has a style and is crawlable

I have a WIP AMP view on my machine, triggered by adding ?amp to the URL.

It has some code quality issues which is why I haven’t shared it yet, also waiting on some pretty bad bugs to be resolved with the AMP script.

Oh I see you are advocating for a basic no-JS discourse.

Your patch however does not do that of course, but the issue is not _escaped_fragment it’s that we’ve never programmed that functionality.

We have discussed improving the no-JS layout but it hasn’t been a priority yet. It’s designed to be crawled now which it does well.

2 Likes

It would be so easy, to just add a link aat the bottom: “print-view” that leads to adding the ?noscript option. I think only two lines of code have to be changed:

  • the one above and
  • one line (to be found) where the stylesheet will be included in case the option is set

does anybody understand the code, to tell this second lline? then the patch would be ready to be implemented

Why do you need print links? Just do File, Print in your browser.

Not really following anything about what you are doing or requesting here.

3 Likes

It seems broken in Chrome stable OS X 10.9.5. Choosing File, Print pops up the dialog for about a second then, before any interaction, it disappears and nothing is printed.

It did that for me too, but when I do it a second time, it remains open… very weird. Chrome stable (v45) on Linux

Seems to only affected me if I’m logged in. Opening an incognito window and trying to Print seems to work. Exact Chrome version is 46.0.2490.71 (64-bit).

I want two things:

  • a link, that I can feed into google translator that works.
  • create a working search function that works, when javascript is disabled
1 Like

[quote=“eviltrout, post:9, topic:33823, full:true”]
There is already a param for this: escaped_fragment – just add it to any URL to get the crawlable version.
[/quote]his doesn’t work anyway:

-> Search results for 'something' - Discourse Metaescaped_fragment

[quote=“rubo77, post:20, topic:33823, full:true”]

search page doesn’t show anything if you disable javascript, differrent issue IMO.

1 Like