Commit Graph

50 Commits

Author SHA1 Message Date
David Taylor 683b172104 UX: Make header/footer HTML consistent for crawler and noscript
These were originally very similar, but have diverged over time. This makes it very difficult to manage styling.

This commit moves the noscript header and footer into partials so they can be reused in both the crawler view and the `<noscript>` view. It also makes browser-update render the noscript content **instead of** the `<section id='main'>`, rather than adding adding the noscript inside the `<section>`. This provides better parity with the server-rendered crawler view.
2022-04-07 15:27:06 +01:00
David Taylor 230e220710 UX: Make crawler view usable under different color schemes
- Ensure the set of rendered `<link rel=stylesheet>` tags is consistent
- Add var() references for all crawler-view styles. Basic color definitions are defined first, as a fallback for super old browsers
2022-04-07 15:27:06 +01:00
Jordan Vidrine b20307377a
linting (#16360) 2022-04-02 10:47:01 -05:00
Alan Guo Xiang Tan 8e3691d537 PERF: Eager load Theme associations in Stylesheet Manager.
Before this change, calling `StyleSheet::Manager.stylesheet_details`
for the first time resulted in multiple queries to the database. This is
because the code was modelled in a way where each `Theme` was loaded
from the database one at a time.

This PR restructures the code such that it allows us to load all the
theme records in a single query. It also allows us to eager load the
required associations upfront. In order to achieve this, I removed the
support of loading multiple themes per request. It was initially added
to support user selectable theme components but the feature was never
completed and abandoned because it wasn't a feature that we thought was
worth building.
2021-06-21 11:06:58 +08:00
Dan Ungureanu 4e46732346
FEATURE: Implement browser update in crawler view (#12448)
browser-update script does not work correctly in some very old browsers
because the contents of <noscript> is not accessible in JavaScript.
For these browsers, the server can display the crawler page and add the
browser update notice.

Simply loading the browser-update script in the crawler view is not a
solution because that means all crawlers will also see it.
2021-03-22 19:41:42 +02:00
Dan Ungureanu 1019789d1a
FIX: Resolve Schema.org validation issues 2020-05-05 16:57:16 +03:00
Dan Ungureanu c85018cdfd
Improve support for old browsers (#9515)
* FEATURE: Improve crawler view

* FIX: Make lazyYT crawler-friendly

* DEV: Rename discourse-internet-explorer to discourse-unsupported-browser

* DEV: Detect more unsupported browsers

Follow-up to 4eebbd2212.

* FIX: Hide browser update notice in print view
2020-04-29 21:40:21 +03:00
Joe 340173eb12 DEV: consistent theme lookup in application / crawler / no-ember views (#7955)
* removes `raw` helpers

* include theme footer in the crawler view

* include theme body tag content in no-ember pages
2019-07-30 19:00:46 +02:00
Kris 98336de266 UX: Cleanup crawler styles, improve schema.org markup (#7668)
* Cleaning up crawler styles, improving some schema.org markup

* Cleaning up crawler styles, improving some schema.org markup

* additional styling

* add space for pagination
2019-06-03 12:03:16 +10:00
Saurabh Patel da2f659635 UX: Improve posts layout for crawler (#7286) 2019-04-03 11:58:00 +02:00
Guo Xiang Tan 44391ee8ab
FEATURE: Upload Site Settings. (#6573) 2018-11-14 15:03:02 +08:00
David Taylor 37fb8fc0e7
FIX: Do not display broken image on crawler/print view (#6575) 2018-11-07 22:28:45 +00:00
Joe 4234058358 UX: don't show crawler navigation in print view (#6551)
* UX: adds CSS classes to crawler navigation links

* UX: hide crawler navigation in print view
2018-11-02 09:18:07 +11:00
Sam Saffron abaa3f0650 FEATURE: add server:before-head-close-crawler outlet for plugins
This outlet allows plugins to inject html prior to closing head tag
2018-10-25 16:31:05 +11:00
Gerhard Schlager cc851af750 FIX: HTML lang attribute expects hyphen instead of underscore 2018-08-20 13:55:58 +02:00
Osama Sayegh 0b7ed8ffaf FEATURE: backend support for user-selectable components
* FEATURE: backend support for user-selectable components

* fix problems with previewing default theme

* rename preview_key => preview_theme_id

* omit default theme from child themes dropdown and try a different fix

* cache & freeze stylesheets arrays
2018-08-08 14:46:34 +10:00
OsamaSayegh decf1f27cf FEATURE: Groundwork for user-selectable theme components
* Phase 0 for user-selectable theme components

- Drops `key` column from the `themes` table
- Drops `theme_key` column from the `user_options` table
- Adds `theme_ids` (array of ints default []) column to the `user_options` table and migrates data from `theme_key` to the new column.
- Removes the `default_theme_key` site setting and adds `default_theme_id` instead.
- Replaces `theme_key` cookie with a new one called `theme_ids`
- no longer need Theme.settings_for_client
2018-07-12 14:18:21 +10:00
Angus McLeod 0997eb6486 Add theme stylesheet(s) to the crawler layout 2018-06-12 12:47:48 +10:00
Neil Lalonde 7dc3671490 FEATURE: remove obsolete settings ga_tracking_code and ga_domain_name. Use ga_universal_tracking_code and ga_universal_domain_name instead. 2017-11-01 11:41:51 -04:00
Neil Lalonde 0b41046238 don't force SiteSetting.title into meta title tag 2017-06-12 13:50:50 -04:00
Sam a3e8c3cd7b FEATURE: Native theme support
This feature introduces the concept of themes. Themes are an evolution
of site customizations.

Themes introduce two very big conceptual changes:

- A theme may include other "child themes", children can include grand
children and so on.

- A theme may specify a color scheme

The change does away with the idea of "enabled" color schemes.

It also adds a bunch of big niceties like

- You can source a theme from a git repo

- History for themes is much improved

- You can only have a single enabled theme. Themes can be selected by
    users, if you opt for it.

On a technical level this change comes with a whole bunch of goodies

- All CSS is now compiled using a custom pipeline that uses libsass
    see /lib/stylesheet

- There is a single pipeline for css compilation (in the past we used
    one for customizations and another one for the rest of the app

- The stylesheet pipeline is now divorced of sprockets, there is no
   reliance on sprockets for CSS bundling

- CSS is generated with source maps everywhere (including themes) this
    makes debugging much easier

- Our "live reloader" is smarter and avoid a flash of unstyled content
   we run a file watcher in "puma" in dev so you no longer need to run
   rake autospec to watch for CSS changes
2017-04-12 10:53:49 -04:00
Rafael dos Santos Silva 24227af9e8 Adds some styling for crawler view 2016-11-14 18:32:59 -02:00
Rafael dos Santos Silva 41d2620d06 Add some styling to print redux version 2016-10-12 14:00:05 -03:00
Rafael dos Santos Silva acc70cc3de SiteSetting, admin passtrough, CSS, hide on mobile 2016-09-26 20:46:55 -03:00
Rafael dos Santos Silva 70c68f0a7c Open print dialog automatically 2016-09-26 20:44:50 -03:00
Sam 49fe5a93b1 tweak logo image 2016-03-17 16:56:47 +11:00
Sam ecbbbbc98c FIX: not showing content on topics for mobile crawler 2016-03-17 15:09:08 +11:00
Neil Lalonde df413737d2 FIX: render About page for web crawlers 2016-03-07 15:28:11 -05:00
Sam 9569235d76 correct path 2016-01-22 07:55:07 +11:00
Sam 7c5a448f63 PERF: remove 10-20ms of work from every page view
<%  s=Time.now;

main_app.categories_path
main_app.guidelines_path
main_app.tos_path
main_app.privacy_path

p (Time.now-s)*1000%>

Returns 10-20ms consistently on i7-4770k, on shared hosts the cost
could easily reach 40ms

This code simply calculates the strings

/categories
/guidelines
/tos
/privacy

It is ludicrous to spend this enormous amount of work just to calculate
4 strings.

I do not know if this is something specific about Discourse or a bug in
Rails (I tried without the main_app prefix and got similar results),
regardless we can got to avoid these _path APIs for now

Discovered this when running a flamegraph on our home page.
2016-01-21 22:43:56 +11:00
Régis Hanol 35e6e5ff67 FIX: footer was missing in some pages
- error pages
- search results pages
- list of all tags
- topics list of a specific tag
- user leaderboard
2015-08-05 16:14:26 +02:00
Arpit Jalan d6069e8c90 UX: fix container layout 2015-07-28 13:58:30 +05:30
Neil Lalonde 1b250f1e01 FIX: crawler pages and RSS had broken links for sites deployed to a subfolder with relative_url_root 2015-04-30 12:46:26 -04:00
Robin Ward 5c49c6b581 FIX: Crawler layout from within plugin routes 2015-04-15 22:41:09 -04:00
Erick Guan c955907f60 FEATURE: add microdata prop and more links for crawler
- add microdata based on schema.org
- add breadcrumb on the top of topic
- add navigations link on the bottom of every pages
- add category description on the category list
2015-03-16 22:52:10 +08:00
Sam f5af4768eb FEATURE: add clean support for running Discourse in a subfolder
To setup set DISCOURSE_RELATIVE_URL_ROOT to the folder you wish
2015-03-09 13:14:29 +11:00
riking c6e27399b3 FIX: Add Google Analytics code to crawler view 2015-02-02 00:49:58 -08:00
Jeff Atwood ef8976d68a better no-js and crawler image sizing 2015-01-15 02:20:38 -08:00
Jeff Atwood 6b30f8444e normalize crawler and no-js views 2015-01-15 01:31:30 -08:00
Jeff Atwood 6a6e254096 move viewport meta tag out of shared header 2015-01-15 00:24:39 -08:00
Régis Hanol 6734a51b6a move SiteText.{head,top,bottom} to SiteCustomization 2015-01-14 12:15:53 +01:00
Robin Ward f3b72f5d96 Revert "move SiteText.{head,bottom} to SiteCustomization and remove redundant SiteText.top"
This reverts commit 6ee2849df6.
2015-01-12 20:21:22 -05:00
Régis Hanol 6ee2849df6 move SiteText.{head,bottom} to SiteCustomization and remove redundant SiteText.top 2015-01-12 19:59:43 +01:00
Régis Hanol fe541891fc remove unnecessary <footer> tags 2014-11-12 14:35:20 +01:00
Robin Ward bc53d48bd7 Renaming site contents to site text 2014-09-24 16:08:14 -04:00
Neil Lalonde 753610f8db Add meta generator tag with the Discourse version. Use a partial for common head elements. 2014-06-19 18:18:09 -04:00
Neil Lalonde 82693daa3d Put the 'Powered by Discourse...' message shown to crawlers and no-js visitors in a footer element so that SEO something something. 2014-06-19 18:18:09 -04:00
Neil Lalonde 63a1f87806 Use topic excerpts and category desriptions in meta description tags for crawlers 2014-05-07 11:21:37 -04:00
Vikhyat Korrapati 5c1fe30cd6 Include opengraph/oembed tags in the crawler layout. 2014-03-16 19:30:26 +05:30
Robin Ward c4b5455c21 REFACTOR: Rename `GooglebotDetection` to `CrawlerDetection` because we
will likely whitelist more crawlers in the future.
2014-02-20 16:07:02 -05:00