Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.
/ craft-gone Public archive

Automatically track exceptions (301, 302, 410, 404 errors) for Craft CMS

License

Notifications You must be signed in to change notification settings

bymayo/craft-gone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Deprecated - This Craft CMS 2.x plugin is no longer supported.

Gone

Gone is a Craft CMS plugin that keeps track of updated and removed elements (E.g. Entries) and then returns the correct error template to the user.

For example, if an element slug has been manually changed, then it will automatically create a 302 redirect.

Features

  • Works with Entries, Categories and Craft Commerce Products
  • Tracks if an element slug has been updated
  • Tracks if an element has been deleted
  • Automatically removes rules if a new element is created with a matching slug
  • Output information on updated / deleted elements
  • Craft 2.5 compatible

Install

  • Add the gone directory into your craft/plugins directory.
  • Navigate to Settings -> Plugins and click the "Install" button.

Templating

The plugin does all the work itself in the background, but if you want to output details about the element that has been deleted you can do so with the following twig tag -

{{ craft.gone.check() }}

This will return an array, which then allows you to use the following options -

id
elementId
type
title
slug
uri
redirect
dateCreated
dateUpdated

E.g.

{% set gone = craft.gone.check() %}

Sorry, but {{ gone.title }} no longer exists.

Custom Error Templates

The above technique is useful if you want to use it on custom error templates. E.g. if you wanted to say "We're sorry but, Product X no longer exists. We've recommended some related products below".

To do this, just create the correct template in your craft/templates folder. E.g. 410.twig or 404.twig.

If you've changed the errorTemplatePrefix setting (https://craftcms.com/docs/config-settings#errorTemplatePrefix) in your config file, ensure the error template files are placed in this folder inside templates.

Roadmap

  • If a structure page is moved, readjust the URL
  • Support multilingual / locale based projects
  • Support section / category setting changes (E.g. if a section URL is changed from 'blog/entry' to 'news/entry')
  • Log 404's as disabled elements

Credits

About

Automatically track exceptions (301, 302, 410, 404 errors) for Craft CMS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published