Exactly this was addressed by D. Andolfatto in this St Louis Fed Explainer:
The phrase “create money out of thin air” refers to the Fed’s ability to create money at virtually zero resource cost. It is frequently asserted that such an ability necessarily leads to “too much” price inflation. Under a gold standard, the temptation to overinflate is allegedly absent, that is, gold cannot be “created out of thin air.” It would follow that a return to a gold standard would be the only way to guarantee price-level stability.
Unfortunately, a gold standard is not a guarantee of price stability. It is simply a promise made “out of thin air” to keep the supply of money anchored to the supply of gold. To consider how tenuous such a promise can be, consider the following example. On April 5, 1933, President Franklin D. Roosevelt ordered all gold coins and certificates of denominations in excess of \$100 turned in for other money by May 1 at a set price of \$20.67 per ounce. Two months later, a joint resolution of Congress abrogated the gold clauses in many public and private obligations that required the debtor to repay the creditor in gold dollars of the same weight and fineness as those borrowed. In 1934, the government price of gold was increased to \$35 per ounce, effectively increasing the dollar value of gold on the Federal Reserve’s balance sheet by almost 70 percent. This action allowed the Federal Reserve to increase the money supply by a corresponding amount and, subsequently, led to significant price inflation.
As explained above, just because country is on gold standard, that does not in any way, shape or form guarantees the amount of money in the economy will always maintain fixed proportion to amount of gold.
That is simply not correct. While gold standard by definition means there is some fixed exchange rate between money and gold (e.g. it could be 1 USD for 10oz of gold). This fixed rate can be changed. Hence country on gold standard can always arbitrarily decide that the exchange between 1 USD and gold will change maybe to 1 USD = 2oz instead of 10oz. Having currency linked to commodity or even be a commodity offers no protection against inflation.
In addition, inflation depends not just on money supply but also money demand which depends on things like real output and interest rates. Even if amount of money in the economy would be fixed, economy can experience inflation if for example real output falls, ceteris paribus.