Preserving Publish Date in URL / Dated Permalink | Ghost 2.0

Preserving Publish Date in URL / Dated Permalink | Ghost 2.0

I can’t say for sure, but I remember Ghost 1.x having a simple way to toggle dates in URL, like https://domain.com/2018/10/11/post-title-here. Instead, by default in 2.0, it’d be https://domain.com/post-title-here

Since I migrated (exported then imported content) to Ghost 2.0, I noticed an immediate drop in hits, and that my URL’s no longer have the date preceding the title of the post.

One must download the Routes YAML file, update it, and send it back. It’s at the very bottom of this URL, adapted for your domain: https://youdomain.com/ghost/#/settings/labs

Here was the default YAML for my Blog:

routes:

collections:
  /:
    permalink: /{slug}/
    template:
      - index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

Here it is after changing the permalink line permalink: /{slug}/ to permalink: /{year}/{month}/{day}/{slug}/:

routes:

collections:
  /:
    permalink: /{year}/{month}/{day}/{slug}/
    template:
      - index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

References