Caerphilly is a town and community in South Wales, at the southern end of the Rhymney Valley. It is the largest town in Caerphilly County Borough, within the historic borders of Glamorgan, on the border with Monmouthshire.

It is a commuter town for Cardiff and Newport, 7.5 miles and 12 miles away respectively, and is separated from the Cardiff suburbs of Lisvane and Rhiwbina by Caerphilly mountain and gives its name to Caerphilly cheese.

According to Wikipedia, at the 2001 Census, the town had a population of 30,388.

Caerphilly is the birthplace of comedian Tommy Cooper, Newport County midfielder David Pipe and Arsenal midfielder Aaron Ramsey. It was also home to Cardiff City FC and Wales footballer Robert Earnshaw, following his family’s move from Zambia.

Caerphilly is featured in the Sex Pistols documentary The Filth and the Fury. Protests and a prayer meeting were held outside the Castle Cinema on the evening of December 14, 1976, when the Pistols were playing a concert there.

However, at this point in time, Caerphilly was one of the few councils that would allow the group to perform (Leeds and Manchester being the others).

The castle of Caerphilly was used as a filming location for Merlin and the Doctor Who episodes The Rebel Flesh and The Almost People (2011).

The town has hosted a food fair, The Big Cheese, in and around Caerphilly Castle every summer since 1998. Visitor numbers reached 80,000 in 2012. The event includes a wide variety of cheese stalls as well as a funfair, fireworks and a cheese race around the castle.

It hosts a fundraising musical event called Megaday. In the Winter there is also the Festival of Light, which involves the procession of hundreds of lanterns through the centre of the town.

Caerphilly hosted the National Eisteddfod in 1950.

The town has a rugby union club, Caerphilly RFC, who play in the Welsh National League.

In 2012 Caerphilly County’s only art gallery, Y Galeri, opened in St Fagan’s Street in the town centre. It was part of plans to build a wider Arts Centre with exhibitions, workshops and talks.

Historically, the town’s site has long been of strategic significance. Around AD 75 a fort was built by the Romans during their conquest of Britain. An excavation of the site in 1963 showed that the fort was occupied by Roman forces until the middle of the 2nd Century.

Tradition states that a monastery was built in the area by St Cenydd, but this claim lacks support. Nonetheless, the district was formerly named Senghenydd after him, and Cenydd’s son, St Ffili, is said to have built a fort (Welsh: caer) in the area and thus gave the town its name. Another explanation is that it is named after the Anglo-Norman Marcher Lord, Philip de Braose.

Following the Norman invasion of Wales in the late 11th Century, the area of Sengenhydd remained in Welsh hands. By the middle of the 12th Century the area was under the control of the Welsh chieftain Ifor Bach (Ifor ap Meurig). His grandson Gruffydd ap Rhys was the final Welsh lord of Sengenhydd, falling to the English nobleman Gilbert de Clare, the Red Earl, in 1266.

In 1267 Henry III was forced to recognise Llywelyn ap Gruffudd as Prince of Wales, and by September 1268 Llywelyn had secured northern Sengenhydd. Gilbert de Clare had already begun to take steps to consolidate his own territorial gains, beginning the construction of Caerphilly Castle on April 11, 1268.

The castle would also act as a buffer against Llewelyn’s own territorial ambitions and was attacked by the Prince of Wales’ forces before construction was halted in 1270. Construction recommenced in 1271 and was continued under the Red Earl’s son, Gilbert de Clare, 8th Earl of Gloucester.

With only interior remodelling carried out to the castle by Hugh le Despenser in the 1320s, Caerphilly Castle remains a pure example of 13th Century military architecture and is the largest castle in Wales, and the second largest in Britain (after Windsor).

The original town of Caerphilly grew up as a small settlement raised just south of the castle by De Clare.

After his death at the battle of Bannockburn in 1314, Edward II became guardian of De Clare’s three sisters and heiresses. In 1315 he replaced de Badlesmere with a new English administrator, Payn de Turberville of Coity, who persecuted the people of Glamorgan.

Then, like many in northern Europe at the time, the region was in the throes of a serious famine. In coming to the defence of his people, Llywelyn Bren, the great grandson of Ifor Bach and Welsh Lord of Senghenydd incurred the wrath of de Turberville, who charged him with sedition.

Llywelyn appealed to Edward II to call off or control his self-interested agent, but Edward ordered Llywelyn to appear before Parliament to face the charge of treason. The King promised Llywelyn that if the charges were found true, he would be hanged. Llywelyn fled and prepared for war.

On January 28, 1316, Llywelyn began the revolt by a surprise attack on Caerphilly Castle. He captured the constable outside the castle and the outer ward, but could not break into the inner defences. They burned the town, slaughtered some of its inhabitants and started a siege.

The town was rebuilt but remained very small throughout the Middle Ages. The first evidence of its emerging importance was the construction of a court house in the 14th Century, the only pre-19th Century building remaining in the town.

At the beginning of the 15th Century the castle was again attacked, this time by Owain Glyndŵr, who took control of the castle around 1403-05. Repairs to the castle continued until at least 1430, but just a century later the antiquary John Leland recorded that the castle was a ruin set in marshland, with a single tower being used as a prison.

In the mid-16th Century the 2nd Earl of Pembroke used the castle as a manorial court, but in 1583 the castle was leased to Thomas Lewis, who accelerated the castle’s dilapidation by removing stonework to build his nearby manor, The Van.

The Lewis family, who claimed descent from Ifor Bach, left the manor in the mid-18th Century when they purchased St Fagans Castle, The Van falling into decay.

During the 1700s, Caerphilly began to grow into a market town, and during the 19th Century, as the South Wales valleys underwent massive growth through industrialisation, so too the town’s population grew.

Caerphilly railway station was opened in 1871, and in 1899 the Rhymney Railway built their Caerphilly railway works maintenance facilities; however, the expansion of the population in the 19th Century was more to do with the increasing market for coal.

See Caerphilly in Pictures, Day Trip to Caerphilly