Giter Club home page Giter Club logo

craft-gone's Introduction

โš ๏ธ 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

craft-gone's People

Contributors

bymayo avatar

Stargazers

 avatar

Watchers

 avatar

craft-gone's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.