Unnecessary code on the website?

AI-generated summary

The discussion on the topic of unnecessary code on the website began with Stranik reporting strange code found in the list.erb template on Discourse Meta, which was also observed on other sites. itsbhanusharma suggested checking the </head> and after header sections in the customize settings. Stranik confirmed the issue was present on multiple sites, including Discourse Meta. itsbhanusharma acknowledged the issue and noted it appeared on their instances as well. sam praised the discovery and shared a fix via a GitHub commit, asking eviltrout to review. Stranik confirmed the issue was resolved and requested the thread be closed. eviltrout acknowledged the subtle fix, noting the importance of returning nil instead of a result.

I looked at the code for this and three other sites (as seen by the search robot) and found on page (./latest) weird code. What is it?

in the template views-site/list/list.erb it is not. Templates clean. I didn’t look further.

4 Likes

Does this exists here on meta as well?

if not then check the customize section of Your website and look if anything unnecessary is left over in your </head> & after header section.

This is a screenshot from this website: Discourse Meta (in the screenshot)
I checked on three different websites, two independent scanners.

Okay! thanks for pointing out!..

I never had really observed this but it does exists on my sandbox and production instances as well so maybe it is something left out. someone from dev team may fix it :wink:

2 Likes

Great catch @Stranik!

Fixed per:

https://github.com/discourse/discourse/commit/cff9b8846dec2d23b7290e479acc14db61b2c7ae

@eviltrout can you review, I think that was your intention there, to allow plugin to unconditionally replace the noscript header?

5 Likes

Everything is corrected. Thank you! The question can be closed.

Yes - the patch is subtle here. The trick is not to return the result too and instead return nil? That makes sense.

1 Like