The study of the sub-structure of complex networks is of major importance to relate topology and functionality. Many efforts have been devoted to the analysis of the modular structure of networks using the quality function known as modularity. However, generally speaking, the relation between topological modules and functional groups is still unknown, and depends on the semantic of the links. Sometimes, we know in advance that many connections are transitive and, as a consequence, triangles have a specific meaning. Here we propose the study of the modular structure of networks considering triangles as the building blocks of modules. The method generalizes the standard modularity and uses spectral optimization to find its maximum. We compare the partitions obtained with those resulting from the optimization of the standard modularity in several real networks. The results show that the information reported by the analysis of modules of triangles complements the information of the classi...