Score:0

Don't serve HTML elements based on their CSS

gb flag

Apache webserver.

I don't want to customize the content management system (MediaWiki) but I do wish to not serve some of its HTML elements, via the webserver, based on their CSS selector (ID/Class).

Pseudocode

<If elementInRequestedWebpage CONTAINS_SELECTOR "#x">
    removeElement;
</if>

Can this be done?

vidarlo avatar
ar flag
Modify the CMS. It's far easier and less complex solution to manage.
gb flag
@vidarlo in general sense I totally agree, but this is a complex CMS (MediaWiki) with many aspects hardcoded in source code, more than any other CMS I know, there isn't even a theming system as you would find in Drupal/WordPress/Joomla; theme files are normally clusterfucks of ~ 1500 lines and I as a non PHP programmer would prefer some server tweak.
us flag
Apache2 cannot do complex content modification like this. Also, content modification like this is very fragile to all kinds of side effects. Also making reliable testing for the modifications is really complex problem. Furthermore, doing modification like this over HTML requires complete HTML parsing, which is very expensive in terms of processing. If you still want to do it, you can look into nginx and its JS module, or nginx lua module.
gb flag
@TeroKilkanen you have reminded Nginx lua which very "catches" me because Lua is the programming language of MediaWiki (as you probably know). Perhaps I can do some stuff like this from MediaWiki itself with Lua?
gb flag
Oh, and one more thing, I host my website on a shared hosting on Namecheap, I don't think I can control Nginx, rather, only Apache `.htaccess`.
us flag
Then your only option is to do the modifications in MediaWiki. How to actually do those is too big a subject for a Q&A site like Serverfault.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.