STANFORD — Stanford won’t have to travel far to face an unfamiliar opponent in Maryland in the Foster Farms Bowl on Dec. 30 at Levi’s Stadium.

After consecutive trips to the Rose Bowl as Pac-12 champion, the Cardinal (7-5) was invited Sunday to a minor postseason matchup about 14 miles south of campus.

Stanford has never faced Maryland, which is playing in its second consecutive bowl game under coach Randy Edsall. The Terrapins (7-5) finished tied for third in the eastern division of the Big Ten after blowing a 25-point lead against Rutgers in the regular-season finale last month.

Coach David Shaw and his staff have a week to start to get his players ready for Maryland’s style when practice resumes Friday.

“I have a broad, general knowledge but over the next couple weeks there will be a lot more specifics,” Shaw said of learning about the Terrapins.

The Stanford coach said his staff studied Maryland in the past to consider borrowing some of the Terps’ playbook.

“They are very good at scheming,” he said. “Defensively, they are physical. They do a good job of recruiting to fit with their schemes.”

Stanford mostly will pursue a strong finish to a disappointing season after expectations to challenge for a college football playoff berth fell way short. Stanford (5-4 in the Pac-12) ended the regular season with blowouts over Cal and UCLA as its often-stymied offense broke out despite missing injured star Ty Montgomery.

Shaw said Sunday that Montgomery’s status should be determined within the week of the bowl game. If the senior wide receiver/kick off returner can play, “he gives us that extra juice and for one more game we get to see this team at its best.”

Shaw said Montgomery’s absence had no bearing on the Cardinal’s sudden improvement on offense, however.

“Our game is to spread the ball around,” he said. “Even in the games we haven’t played well the ball is spread around.”

Shaw attributed the recent success to vastly improved play by the offensive line and quarterback Kevin Hogan, who had his best game of the season in a 31-10 victory over UCLA last month at the Rose Bowl.

“It was one of those things when everything kind of came together to where we are just playing at a high level at all positions,” Shaw said. “It just so happened that one of our best players wasn’t there.”

The coach sees no reason for the Cardinal to hit a lull despite a month between the UCLA stunner and the bowl game.

“It wasn’t momentum that got us to play that well,” he said. “It was part of some of the struggles that we went through.”

Because of its mediocre record, Stanford seemed destined for the lowly Cactus Bowl that will feature Washington and Oklahoma State. The Cardinal got a break when Fiesta Bowl officials picked Arizona for its Dec. 31 game in Glendale, Arizona.

Shaw is happy his players get to experience the 49ers’ new $1.3 billion stadium. But he had no preferences other than the playoffs.

“As far as the status of the bowl, just get to a bowl game so we can go play,” he said.

Stanford has never participated in the 12-year-old bowl, which had been held at AT&T Park until this season. Maryland played in 2007 against Oregon State when the game was known as the Emerald Bowl.