Rewrite ContentRightSidebar into a proper class

Also restore proper semantic separation between modules by using a
BeforePageDisplay hook.