The increasing number of online resources makes effective matching of students’ individualized learning needs become the focus of the teaching reform of ideological and political theory courses. In this paper, we construct students’ user profiles in two directions: dynamic and static, and utilize Jaccard and cosine similarity to calculate the similarity of user profile features. The Louvain algorithm is introduced to divide the community of “user characteristics-user-item-item characteristics” association network to improve the efficiency of resource recommendation. We design an improved collaborative filtering model based on a multi-layer resource recommendation matrix, and generate a dynamic resource list by combining the time decay function to correct students’ interests. The results show that the model improves the recommendation performance by 10.03%-73.47% compared with other benchmark methods. Practical teaching applications improve students’ self-initiated motivation and learning efficiency at the 0.01 significance level. The number of students with high scores (≥90 points) increased from 16.3% to 26.2%. The resource recommendation model based on the improved collaborative filtering algorithm can realize the effective recommendation of resources and assist students to improve the level of Civics Theory course.