Jinja buildings, like any other, sometimes need to be repaired or rebuilt. For most of the structures, this is no more, and no less, complex than for any other building. The main sanctuary, however, has a different problem.
The main sanctuary normally houses the goshintai, the object inhabited by the kami. It would be very disrepectful to do the repairs around the goshintai, so the kami has to be moved somewhere else, to a temporary sanctuary, while the work is done. Moving the kami is itself a ceremony, called a “senzasai”, which is normally performed at night, with all the lights in jinja precincts turned off, and the goshintai hidden inside a chest, which in turn is inside a set of white curtains that are carried with it. One ceremony is performed to move the goshintai to the temporary sanctuary before the repairs start, and another to move it back to the main sanctuary when they are complete. There are some jinja where these ceremonies are the only occasion on which even the chief priest enters the main sanctuary, so decades may pass between such occasions.
The temporary sanctuary varies a great deal. Large and famous jinja often have particular arrangements. For example, Jingū, in Isë, does not need a temporary sanctuary, because it has two plots of grounds on which the sanctuaries can be built, and so the goshintai is left in the current main sanctuary while the new one is built, and the old one is dismantled (and almost all its wood reused in other jinja) after the goshintai has moved. At Kamowakëikazuchi Jinja, also known as Kamikamo Jinja, in Kyoto, there are two basically identical sanctuary buildings, but one is empty most of the time, and is used as the temporary sanctuary when the main sanctuary is being repaired. At Kasuga Taisha in Nara, there is a particular building in the complex that is used as the temporary sanctuary.
Smaller jinja generally do not have the space to have dedicated buildings, or to build an entire new sanctuary complex without touching the old one. In many cases, however, there are several buildings around the sanctuary: the main sanctuary, an offering hall, and a prayer hall are common. In such cases, the offering hall, if one exists, is often used as the temporary sanctuary. This has the advantage that the prayer hall can be used for ceremonies as normal. If there is no offering hall, then the prayer hall is likely to be used, even though that means that no-one can enter the prayer hall until the repairs are finished. Another possibility is for the kami to go and stay with a friend. That is, if there is more than one jinja on the same site, a fairly common situation, the goshintai from one main sanctuary may be moved to another main sanctuary while the repairs are in progress.
In some cases, a new building may be constructed to serve as the temporary sanctuary. A famous example of this is Kamomioya Jinja, also known as Shimokamo Jinja, in Kyoto. This jinja is closely connected to Kamikamo Jinja, and also has two sanctuaries next to each other. However, in this case there is normally a kami in each, and so temporary sanctuaries are built behind and to the side of each main sanctuary.
The impetus for this article was Meiji Jingū in Tokyo. This jinja was founded in 1920 to enshrine Meiji Tennō and his Empress, and it is undergoing a large-scale refurbishment in preparation for its centenary. This has recently reached the main sanctuary, so a temporary sanctuary was necessary. The jinja built a completely new sanctuary building, in hinoki (a kind of cypress, and quite expensive), between the offertory boxes and the current main sanctuary, so that people could still pay their respects in the same place as before. There are very few jinja in Japan that could afford to build something like that even as their main sanctuary.