Geometric quantum gates are performed by using the geometric phase, making them particularly robust to the pulse amplitude error. However, in many systems, such as the silicon-based spin qubits, the off-resonance error is the dominant noise, which can cause dephasing and is always difficult to deal with for a geometric gate. Thus how to combat with the off-resonance error is very significant for the application of the geometric gates. A recent work [S. Li and Z.-Y. Xue, Phys. Rev. Appl. 16, 044005 (2021).] revealed that by inserting two $\ensuremath{\pi}$ pulses into the evolution paths, the holonomic quantum gate is effective to suppress the pulse amplitude error, however, it is still useless for combating the off-resonance error. Inspired by this work, we combine using the techniques of dynamical correction and path design. Surprisingly, we find that, by picking up a specific evolution path inserted by only a $\ensuremath{\pi}$-pulse, the obtained optimized geometric gate is robust to the off-resonance error, assuming the noise is static. Further, by calculating the filter function considering the realistic $1/f$-type noise in silicon, the related results show that the performance of the optimized geometric gate can also surpass both the conventional geometric gate and the naive dynamical gate constructed without using the geometric phase. Our results indicate dynamical correction is a powerful tool to improve the geometric quantum computation to achieve a high-fidelity quantum gate in silicon.