Renaming ContentTypes
Sometimes, you might want to change the name of an existing ContentType, after development of a site is well under way. Here's how to rename one, without losing existing content.
Let's say you have a ContentType like this:
members:
name: Members
singular_name: Member
By not specifying the slug
explicitly, Bolt assumes the key of the node to be the Slug. In this case members
, which will also make /members/
be the URI for the listing page. But, let's say you determine you want to have /memberlist/
for all members, and /member/mike
for a single member.
You can do this by adding them like this:
members:
name: Members
slug: memberlist
singular_name: Member
singular_slug: member
This will work as expected, with one big pitfall. Since the ContentType is now effectively called memberlist
, all existing members will no longer show up in the Backend.
For now, the easiest way to fix this, is by manually updating the rows in the Database. Use your preferred Database tool, go to the bolt_content
table and run the following query:
UPDATE bolt_content SET content_type="memberlist" WHERE content_type="members";
Obviously, replace memberlist
with your own new ContentType slug. If you're not sure about the previous implied name, just look at the content_type
column in that table for what the ole one used to be.