Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance readme and documentation #69

Merged
merged 9 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 59 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SuluRedirectBundle
<h1 align="center">SuluRedirectBundle</h1>

<p align="center">
<a href="https://sulu.io/" target="_blank">
Expand All @@ -7,57 +7,81 @@
</p>

<p align="center">
<a href="https://github.com/sulu/SuluRedirectBundle/blob/2.x/LICENSE" target="_blank">
<img src="https://img.shields.io/github/license/sulu/SuluRedirectBundle.svg" alt="GitHub license">
</a>
<a href="https://github.com/sulu/SuluRedirectBundle/releases" target="_blank">
<img src="https://img.shields.io/github/tag/sulu/SuluRedirectBundle.svg" alt="GitHub tag (latest SemVer)">
</a>
<a href="https://github.com/sulu/SuluRedirectBundle/actions" target="_blank">
<img src="https://img.shields.io/github/workflow/status/sulu/SuluRedirectBundle/Test%20application.svg?label=test-workflow" alt="Test workflow status">
</a>
<a href="https://github.com/sulu/sulu/releases" target="_blank">
<img src="https://img.shields.io/badge/sulu%20compatibility-%3E=2.0-52b6ca.svg" alt="Sulu compatibility">
</a>
</p>
<br/>

<a href="https://github.com/sulu/SuluRedirectBundle/blob/2.x/LICENSE" target="_blank">
<img src="https://img.shields.io/github/license/sulu/SuluRedirectBundle.svg" alt="GitHub license">
</a>
<a href="https://github.com/sulu/SuluRedirectBundle/actions" target="_blank">
<img src="https://img.shields.io/github/workflow/status/sulu/SuluRedirectBundle/Test%20application.svg?label=test-workflow" alt="Test workflow status">
</a>
<a href="https://github.com/sulu/sulu/releases" target="_blank">
<img src="https://img.shields.io/badge/sulu%20compatibility-%3E=2.0-52b6ca.svg" alt="Sulu compatibility">
</a>
The SuluRedirectBundle adds simple but powerful capabilities for managing redirects to Sulu’s administration interface
and allows content managers to manage redirects without any knowledge of web servers.

<br/>
<p align="center">
<img width="80%" src="https://sulu.io/uploads/media/800x@2x/02/342-SuluRedirectBundle%20Slideshow.gif?v=1-0" alt="SuluRedirectBundle Slideshow">
</p>
<br/>

The SuluRedirectBundle is compatible with Sulu **starting from version 2.0**. Have a look at the `require` section in
the [composer.json](https://github.com/sulu/SuluRedirectBundle/blob/2.x/composer.json) to find an
**up-to-date list of the requirements** of the bundle.

## 🚀&nbsp; Installation and Documentation

Execute the following [composer](https://getcomposer.org/) commands to add the bundle to the dependencies of your
project:

The SuluRedirectBundle adds support for managing redirects in Sulu.
```bash
composer require sulu/redirect-bundle
```

Additional features included:
Afterwards, visit the [bundle documentation](https://github.com/sulu/SuluRedirectBundle/blob/2.x/Resources/doc) to
luca-rath marked this conversation as resolved.
Show resolved Hide resolved
find out **how to set up and configure the SuluRedirectBundle** to your specific needs.

* Content-Manager can create new redirect-routes in Sulu-Admin
* Import redirect-routes from csv
## 💡&nbsp; Features

## Status
### Importing redirects

This repository will become version 1.0 of SuluRedirectBundle. It is under **heavy development** and currently its APIs
and code are not stable yet (pre 1.0).
One of the great features of this bundle is the ability to import redirects from a CSV file.
The most simplified file just contains two columns, `source` and `target`.
Of course, all the other options like `statusCode`, `sourceHost`, and `enabled` can also be set in the import file.

## Requirements
It’s also possible to override existing redirects with an import; you just have to set the same value for `source`.

* Composer
* PHP `^7.2`
* Sulu `^2.0.0`
### Enabling and disabling redirects

For detailed requirements see [composer.json](https://github.com/sulu/SuluRedirectBundle/blob/2.x/composer.json).
Sometimes it’s necessary to prepare redirects which are not ready yet, especially if you have a large number of redirects.
Of course there’s a solution for that — toggler in the toolbar to enable or disable redirects quickly.
This allows you to import a large number of disabled redirects and then check them in the administration interface,
before enabling them when needed.

## Documentation
### Different statuses

The the Documentation is stored in the
[Resources/doc/](https://github.com/sulu/SuluRedirectBundle/blob/2.x/Resources/doc) folder.
The SuluRedirectBundle comes with three different statuses to be used for redirects:

## Installation
- **301** Moved permanently
- **302** Moved temporarily
- **410** Gone
luca-rath marked this conversation as resolved.
Show resolved Hide resolved
luca-rath marked this conversation as resolved.
Show resolved Hide resolved

All the installation instructions are located in the
[Documentation](https://github.com/sulu/SuluRedirectBundle/blob/2.x/Resources/doc/installation.md).

## License
## ❤️&nbsp; Support and Contributions

This bundle is under the MIT license. See the complete license [in the bundle](LICENSE)
The Sulu content management system is a **community-driven open source project** backed by various partner companies.
We are committed to a fully transparent development process and **highly appreciate any contributions**.

## Reporting an issue or a feature request
In case you have questions, we are happy to welcome you in our official [Slack channel](https://sulu.io/services-and-support).
If you found a bug or miss a specific feature, feel free to **file a new issue** with a respective title and description
on the the [sulu/SuluRedirectBundle](https://github.com/sulu/SuluRedirectBundle) repository.

Issues and feature requests are tracked in the [Github issue tracker](https://github.com/Sulu/SuluRedirectBundle/issues).
## 📘&nbsp; License

When reporting a bug, it may be a good idea to reproduce it in a basic project using the
[Sulu Skeleton](https://github.com/sulu/skeleton) to allow developers of the bundle to reproduce the issue
by simply cloning it and following some steps.
The Sulu content management system is released under the terms of the [MIT License](LICENSE).
23 changes: 23 additions & 0 deletions Resources/doc/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Configuration

The following code snippet shows all the available configuration options for the SuluRedirectBundle.

```yml
# config/packages/sulu_redirect.yaml

sulu_redirect:

# When enabled, this feature automatically creates redirects with http status code 410 when a document with route or an route entity is removed.
gone_on_remove:
enabled: true

# The directory where the uploaded csv files should be stored
imports:
path: '%kernel.project_dir%/var/uploads/redirects'

# Configuring the objects for `redirect_route` allows setting a custom entity or repository class
objects:
redirect_route:
model: Sulu\Bundle\RedirectBundle\Entity\RedirectRoute
repository: Sulu\Bundle\RedirectBundle\Entity\RedirectRouteRepository
```
31 changes: 8 additions & 23 deletions Resources/doc/installation.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# Installation

Install bundle over composer:
### Install bundle using composer:

```bash
composer require sulu/redirect-bundle
```

Add bundle to config/bundles.php:
### Add bundle to `config/bundles.php`:

**Tip**: If community flex recipes are enabled, this should be done automatically.

```php
Sulu\Bundle\RedirectBundle\SuluRedirectBundle::class => ['all' => true],
```

Add routing files to `config/routes/sulu_redirect_admin.yaml`:
### Add routing files to `config/routes/sulu_redirect_admin.yaml`:

**Tip**: If community flex recipes are enabled, this should be done automatically.

```yml
sulu_redirect_api:
Expand All @@ -25,27 +29,8 @@ sulu_redirect:
prefix: /admin/redirects
```

## Initialize bundle

Create tables
### Create necessary database tables

```bash
php bin/console doctrine:schema:update
```

## Available Configuration

```yml
sulu_redirect:

# When enabled, this feature automatically creates redirects with http status code 410 when a document with route or an route entity is removed.
gone_on_remove:
enabled: true
imports:
path: '%kernel.project_dir%/var/uploads/redirects'
objects:
redirect_route:
model: Sulu\Bundle\RedirectBundle\Entity\RedirectRoute
repository: Sulu\Bundle\RedirectBundle\Entity\RedirectRouteRepository
```