Giter Site home page Giter Site logo

grav-plugin-yandex-turbo's Introduction

Yandex Turbo Plugin

The Yandex Turbo Plugin is an extension for Grav CMS that generates a RSS feed of your blog in accordance with the Yandex.Turbo technology. The yandex-turbo plugin works out of the box. You can just go directly to https://yoursite.com/turbo and you will see the generated RSS.

Installation

Installing the Custom Translate Widget plugin can be done in one of three ways:

  • via GPM (Grav Package Manager): bin/gpm install yandex-turbo
  • via a zip file: extract the package into /your/site/grav/user/plugins and rename to yandex-turbo
  • via the Admin Plugin.

Configuration

Note that if you use the Admin Plugin, a file with your configuration named yandex-turbo.yaml will be saved in the user/config/plugins/ folder once the configuration is saved in the Admin.

In manual mode, before configuring this plugin, you should copy the user/plugins/yandex-turbo/yandex-turbo.yaml to user/config/plugins/yandex-turbo.yaml and only edit that copy.

enabled: true
route: '/turbo'
feed_title: null
feed_description: null
max_content_length: 150
content: null
content_source: desc
show_author: true
show_pubdate: true
sort_by: date
sort_dir: desc
image_effects:
  resize: false
  cropResize: true
  grayscale: false
image_width: 300
image_height: 200
enable_cache: false

How to remove a specific page from the feed

Add the following lines to the header of the page file:

yandex_turbo:
    active: false

Плагин Yandex Turbo при обращении к адресу https://yoursite.com/turbo формирует специальную RSS-ленту, которую можно добавить в качестве источника Турбо-страниц в Вебмастере.

Установка

Установка плагина Custom Translate Widget может быть выполнена одним из трех способов:

  • через GPM (менеджер пакетов Grav): bin/gpm install yandex-turbo
  • с помощью zip-файла: извлеките содержимое архива в /your/site/grav/user/plugins, затем переименуйте в yandex-turbo
  • с помощью плагина админки.

Конфигурация

При сохранении настроек через плагин админки нужный файл с настройками плагина будет создан автоматически.

Если же админкой вы не пользуетесь, скопируйте файл user/plugins/yandex-turbo/yandex-turbo.yaml в user/config/plugins/yandex-turbo.yaml и редактируйте последний.

enabled: true
route: '/turbo'
feed_title: null
feed_description: null
max_content_length: 150
content: null
content_source: desc
show_author: true
show_pubdate: true
sort_by: date
sort_dir: desc
image_effects:
  resize: false
  cropResize: true
  grayscale: false
image_width: 300
image_height: 200
enable_cache: false

Как убрать конкретную страницу из ленты

Добавьте в шапку файла страницы строчки:

yandex_turbo:
    active: false

grav-plugin-yandex-turbo's People

Contributors

dragomano avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

grav-plugin-yandex-turbo's Issues

Setting to change the max content length

Setting to change the max content length
have some problem if in item.md:

xxxxxxxxxxxxxxxxxxxxxxxx

===
___
yyyyyyyyyyyyyyy

Display only: xxxxxxxxxxxxxxxxxxxxxxxx

More words for item content

{{ item.content|safe_truncate_html }}
it
safeTruncateHtml(string $text, int $length=25, string $ellipsis='...') : string
Truncate HTML by number of characters in a "word-safe" manor.

Can you use any other or maybe set restriction in settings by using 25/50/75/100 or maybe any number of words or characters?

Undefined variable: cache_id

Whoops \ Exception \ ErrorException (E_NOTICE)
Undefined variable: cache_id

/user/plugins/yandex-turbo/yandex-turbo.php

     * @return void
     */
    public function onTwigTemplatePaths()
    {
        $this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
    }
 
    /**
     * Generate data for the turbo pages.
     *
     * @return void
     */
    public function onPagesInitialized()
    {
        if ($this->config->get('plugins.yandex-turbo.enable_cache')) {
            $cache = Grav::instance()['cache'];
            $cache_id = md5('yandex_turbo_plugin');
        }
 
        if ($cache_id && $data = $cache->fetch($cache_id)) {
            $this->items = $data;
        } else {
            /** @var Pages $pages */
            $pages = $this->grav['pages'];
            $collection = $pages->all();
            $collection = $collection->visible()->published()->routable()->order('date', 'desc')->slice(0, 1000);
 
            foreach ($collection as $page) {
                $header = $page->header();
                $page_ignored = isset($header->external_url) || isset($header->access);
 
                if (!$page_ignored) {

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.