Custom permalinks in Ghost

Ghost by default only lets you have dated permalink :year/:month/:day/:slug or title :title based with is set by default.

You can change this by editing the Sqlite Database and updating the the permalink column, this will let you have custom url for your posts, this will only affect urls of your posts and not pages.

Backup the Database before making any changes to it.

You need stop Ghost, than access the Database using Sqlite CLI.

sqlite3 content/data/ghost.db  

In development mode the Database will be ghost-dev.db.

sqlite3 content/data/ghost-dev.db  

Use the query below.

UPDATE settings SET value = ‘/journal/:slug/` WHERE key = 'permalinks'  

Now your permalink will be http://example.com/journal/welcome-to-ghost/, you can set journal to anything you like.

After this step you can start Ghost.

If you visit the settings panel in your Ghost admin, you will see. that the dated permalink has been tick(turned on), this is because Ghost believes that you are using dated permalinks.

If you want to revert back, you can tick the dated permalink under settings panel in Ghost admin, this will set the url back to the default :slug, you can re tick the dated permalink and enable the actual dated permalink.

Happy Blogging.

Have a question? leave a comment below.

Leave a Reply