With a view towards Riemannian or sub-Riemannian manifolds, RCD metric spaces and specially fractals, this paper makes a step further in the development of a theory of heat semigroup based $(1,p)$ Sobolev spaces in the general framework of Dirichlet spaces. Under suitable assumptions that are verified in a variety of settings, the tools developed by D. Bakry, T. Coulhon, M. Ledoux and L. Saloff-Coste in the paper Sobolev inequalities in disguise allow us to obtain the whole family of Gagliardo-Nirenberg and Trudinger-Moser inequalities with optimal exponents. The latter depend not only on the Hausdorff and walk dimensions of the space but also on other invariants. In addition, we prove Morrey type inequalities and apply them to study the infimum of the exponents that ensure continuity of Sobolev functions. The results are illustrated for fractals using the Vicsek set, whereas several conjectures are made for nested fractals and the Sierpinski carpet.