Keelung Huguo City God Temple is located on Zhongyi Road in Ren'ai District. The temple gate faces Keelung Harbor. Legend has it that it was built in 1887 (the 13th year of the Guangxu Emperor's reign) by donations from Jiang Chenghui, a Juren (successful candidate in the imperial examinations), and Zhang Shanglian, a Xiucai (successful candidate in the county-level imperial examinations), due to frequent natural disasters and man-made calamities in the area. According to the "Taiwan Scenic Spots Interview Book" by Lin Hengdao, a historian, local legend says that the City God of Keelung City God Temple is Bao Rong, the seventh coastal defense magistrate of Keelung Prefecture during the Qing Dynasty. He was a kind-hearted, honest, diligent, and people-loving official, but he died in office due to overwork. After his death, local officials and people praised his virtues and enshrined his clay statue here, honoring him as the Huguo City God, and he was also named the City God of Keelung.
The distinctive feature of the City God Temple's spatial planning is the interconnectedness of the "Three-Way Hall," the "Worship Hall," and the "Main Hall," forming an "工" (gong) shape, creating a solemn and dignified atmosphere. The temple's architecture employs undulating levels, contrasts of light and shadow, gradually rising floors, and repetitive columns to create an oppressive and somber ambiance. A large abacus hangs high in the main hall, said to be used to calculate human good and evil deeds, serving as a warning and punishment to the world.
The annual City God Cultural Festival is the biggest event at the City God Temple, attracting many onlookers and participants. After the gates of hell are closed in the seventh lunar month, the Keelung City God Temple, according to custom, invites the City Gods of various counties and cities to take a yacht around Keelung Harbor on the 14th day of the eighth lunar month, followed by a night patrol in the evening. On the 16th of the eighth lunar month, there is a daytime patrol for peace. According to traditional folk beliefs, after the gates of hell are closed, there are still mischievous wandering souls who, after enjoying the offerings and sacrifices, linger in the human world and are unwilling to return to hell. Therefore, the City God must lead his generals to circle the city to drive away the wandering souls, bring good fortune and avoid misfortune, and protect the people's peaceful life. It also serves as a warning to the world, just like the couplet on the gate of the City God Temple: "Good deeds will surely prosper, evil deeds will surely perish."
The annual Keelung City God Cultural Festival is usually organized by the City God Temple, which hosts a series of related activities, making the entire Keelung area quite lively. Sometimes, the Seventh and Eighth Lords from various counties and cities are invited to perform and introduce the history and significance of the City God Temple to the public. The Seventh and Eighth Lords also distribute strings of salted biscuits hanging around their necks to the public on the spot, which are said to ward off disasters and bring peace.