It has long been customary for rabbis to deliver important derashot (sermons or homilies) on Shabbat, in which they deal with halakhic and theological matters. These would be attended by the entire community. This important practice has its foundation in God’s instruction to Moshe:
God said to Moshe: “Gather together large groups and publicly teach them the laws of Shabbat. Thus, future leaders will learn from you to convene groups every Shabbat and assemble in the batei midrash to teach and instruct Israel about what the Torah permits and forbids. Thus My great name will be glorified among My children.” Based on this, the Sages averred: Moshe instituted that Israel discuss matters pertaining to the day – the laws of Pesaĥ on Pesaĥ, the laws of Shavu’ot on Shavu’ot, the laws of Sukkot on Sukkot. Moshe said to Israel: “If you follow this system God will consider it as if you enthroned Him in His world, as it is stated: ‘You are My witnesses, declares the Lord’ (Yeshayahu 43:10).” (Yalkut Shimoni, Vayak’hel §408)
One may not schedule a meal during the drasha (SA 290:2). According to the Sages, doing so is one of the reasons that wealthy people become impoverished. We are told that there was a family in Jerusalem who regularly scheduled meals during the drasha, and on account of this sin they were wiped out (Gittin 38b).
Zeira recounts that originally he thought that people who ran to hear the drasha were desecrating Shabbat by not walking there unhurriedly. But, after he heard R. Yehoshua b. Levi say, “One should always run to hear words of Torah, even on Shabbat,” he too would run to the drasha (Berakhot 6b). Because the drasha was meant to address the entire community, it was difficult to calibrate it to meet everyone’s needs. There were some who already knew everything that the rabbi was about to teach, while others could not understand a thing he was saying. This is why the Sages stated: “The reward for the drasha is for running to attend it” (ibid.). For the fact that people are running and gathering to hear the drasha already honors the Torah. The Shekhina rests upon them, which allows them to strengthen their faith and their connection to Torah and mitzvot. In any case, one who does not attend the drasha should study Torah during the time it is delivered. Under no circumstances should he schedule his meal then or plan to take a walk (MB 290:7).
The primary goal of the drasha is to teach the community practical halakha and to guide the audience in the ways of God, as the Sages state: “to teach and instruct Israel about what the Torah permits and forbids” (Yalkut Shimoni loc. cit.). Once, R. Abahu and R. Ĥiya happened to be in the same place on Shabbat. R. Abahu held forth on matters of aggada while R. Ĥiya taught of halakha. Most of the listeners left R. Ĥiya’s drasha and went to listen to R. Abahu. R. Ĥiya was upset about this because R. Abahu had deviated from the primary purpose of the drasha, which was to offer halakhic instruction. Although R. Abahu tried to appease R. Ĥiya, he refused to be placated (Sota 40a). We can assume that R. Abahu felt that the community was at a low point and needed to be encouraged in their faith through aggada, while R. Ĥiya felt the community had the strength to hear a halakhic discourse.
The bottom line is that everything depends on the community and what areas it must improve. Generally, a mixture of halakha and the reasons behind it, together with some theology and moral instruction, is called for. Indeed, this was the custom of many leading Torah scholars (see Tur §290; Baĥ; MA; SAH 290:3; MB ad loc. 6).
It is incumbent upon the community leaders to strengthen communal Torah study on Shabbat and to schedule many varied classes for men and women, old and young, on halakhic and aggadic topics, in Tanakh and in Talmud, so that everybody can participate. Included in this is the need to encourage and schedule a central drasha for the entire community, to give honor to Torah and reinforce its status.