Upvote:2
The loss in the first third of the 19th century of the American territories (Spain did not really have "colonies" in the way the British Empire had, the American territories were integral part of Spain) did not have any significant impact on Spain`s public discourse, because the American territories had never really had.
However, with the development of nationalist ideology and sentiment all over Europe in the course of the 19th century (as a result of the French revolution and the Napoleonic wars), a rudimentary form of Spanish nationalism began to grow in the second third of the century. By the time nationalism had acquired a critical mass in Spain sufficient to influence public discourse, it was already firmly established in England, France and Germany.
By the end of the 19th century, nationalism was also in Spain the driving force of historical theory and had pervaded politics and literature, as it had done in the above mentioned countries decades before. Nationalistic nostalgia for a "fictional" Spanish Empire made the loss of Cuba, Puerto Rico and the Philippes in 1898 appear as a catastrophe for the nation.
Funnily enough, it was only after the American territories gained their independence that the relations between Spain and so-called Latin America started to gain momentum (emigration, trade).