Metadata-Version: 2.1
Name: wagtail-webstories-editor
Version: 0.0.1
Summary: Integrate Google Web Stories Editor in Wagtail Projects.
Home-page: https://github.com/wmo-raf/wagtail-webstories-editor
Author: Erick Otenyo
Author-email: otenyo.erick@gmail.com
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: wagtail>=5.1.2
Requires-Dist: django-filter
Requires-Dist: wagtailmedia>=0.14.4

# wagtail-webstories-editor

Integrate Google Web Stories Editor in Wagtail Projects.

This is an effort to integrate the standalone version
of [Web Stories for WordPress plugin](https://github.com/GoogleForCreators/web-stories-wp) into wagtail.

# Table of Contents

- Overview
    - Features
- Installation
- Usage
- Example App

# Overview

This package brings [Web Stories for WordPress plugin](https://github.com/GoogleForCreators/web-stories-wp) to Wagtail
by providing integrations with the Wagtail Admin, mainly by use of custom snippet viewsets

![Sample Story](screenshots/editor_interface.png)

## Features

- Editor for creating webstories. The editor brings most features provided by
  the [Web Stories for WordPress](https://github.com/GoogleForCreators/web-stories-wp)
- Dashboard for listing and managing stories
- Settings interface for configuring web stories settings including:
    - Google Analytics Integration
    - Setting publisher logos
    - Opt-in to use Google Cache for videos
- Integration with `Wagtail Images` to use the Wagtail image chooser
  and [Wagtail Media](https://github.com/torchbox/wagtailmedia) to use it's `Media Choosers` for `Audio` and `Video`
- On top of the features provided by the Editor and Dashboard, the package uses most of
  the  [Snippets Optional Features](https://docs.wagtail.org/en/v5.1.3/topics/snippets/features.html) to bring enable
  the following features:
    - Making WebStories previewable using the wagtail `PreviewableMixin`
    - Saving revisions for WeStories using `RevisionMixin`
    - Saving draft changes for WebStories using `DraftStateMixin`
    - Locking WebStories using `LockableMixin`
    - Enabling workflows for WebStories using `WorkflowMixin`

# Installation

```shell
pip install wagtail-webstories-editor
```

The following dependencies will be installed as well if not yet installed:

- django-filter
- wagtailmedia

# Usage

Add the following to your `INSTALLED_APPS` if not yet added:

```python

INSTALLED_APPS = [
    ...
    "wagtail_webstories_editor",
    "wagtail.api.v2",
    "wagtailmedia",
    "django_filters",
    "wagtail.contrib.settings",
    "django.contrib.sitemaps",

    ...
]

```

Run migrations

```shell
python manage.py migrate wagtail_webstories_editor
```

If everything went ok, a new `Web Stories` menu item will be to your Wagtail Admin Menu

![Admin Menu](screenshots/admin_menu.png)

1. Click to show the WebStories dashboard
2. Create a new WebStory
3. Access WebStories Settings

# Settings

- `WAGTAIL_WEBSTORIES_EDITOR_LISTING_PAGE_MODEL` : Model for your WebStories listing Page. This will be used to generate
  urls for individual stories, since stories are saved as snippets and not Wagtail Pages. See below for details

## Integrating with Wagtail pages for story links and SEO

WebStories uses Wagtail Snippets to integrate the Editor and Dashboard. The settings component uses Wagtail Site
Settings.

To get links for individual WebStories on publishing, you create a listing page and tell the WebStories package about
it. The package provides an abstract page that you could inherit from:

```python
# app/models.py
from wagtail_webstories_editor.models import AbstractWebStoryListPage


class WebStoryListPage(AbstractWebStoryListPage):
    pass

```

and then in your `settings.py`, tell webstories of the page using the setting defined above:

````python
# settings.py

WAGTAIL_WEBSTORIES_EDITOR_LISTING_PAGE_MODEL = "app.WebStoryListPage"

````

Ideally you should create `only one` instance of this WebStoryListPage in your Wagtail Project. If you create multiple,
the first one to be queried will be used

The `AbstractWebStoryListPage` adds a few functionalities to help working with WebStories:

- By using
  Wagtail's [RoutablePageMixin](https://docs.wagtail.org/en/stable/reference/contrib/routablepage.html),WebStories will
  be served to users using sub-urls from the listing page
- By extending `get_sitemap_urls` method of the Wagtail's Page model, we are able to add all the urls of `live`
  WebStories to Wagtail's autogenerated sitemap, and thus making sure your WebStories are well indexed for SEO




