To improve the generalization performance of robot trajectory generation algorithms, a manipulator trajectory generation strategy based on spatio-temporal feature template (STFT) is proposed. Firstly, to solve the problem that the manipulation time and amplitude of the demonstration trajectories are different greatly, the generalized canonical time warping (GCTW) method is adopted to unify the variation of the time and amplitude. In this way, the common feature template for demonstration trajectories is obtained. Secondly, based on STFT, smoothness constraints and task constraints of robot trajectory generation are introduced into the objective function for trajectory generation, and the function is then optimized. Finally, the trajectory generation strategy is verified on NAO robot platform. The curved trajectories and digital figure trajectories are generated based on STFT. The experimental results show that the proposed STFT-based trajectory generation strategy can generate robot trajectories satisfying the desired conditions and demonstrating some generalization performance.