In the fiscal theory of the price level, inflation and debt dynamics are determined jointly. We derive optimal monetary policy rules that can approximate the Ramsey outcome in this environment. When the government issues a portfolio of bonds of different maturities and buys it back every period the optimal interest rate response to inflation is a simple, transparent function of the average debt maturity. This policy exploits the maturity structure to minimize the intertemporal variability of inflation in response to fiscal shocks. We then turn to the more realistic scenario of no buyback assuming that the government does not repurchase and reissue debt in every period. In the case where debt is only long term, the optimal policy equilibrium features oscillations in inflation and simple inflation targeting rules may lead to explosive inflation dynamics. Issuing both short and long bonds rules out oscillations and allows simple rules to approximate the Ramsey outcome closely. Underlying these results is the ability of the optimizing policy authority to smooth distortions stemming from inflation across periods. When debt is short term or it is bought back in every period, the planner can spread evenly the distortions over time. Under no repurchases, this ability is lost.