Skip to content

Instantly share code, notes, and snippets.

View 4e6ka's full-sized avatar

Denis K 4e6ka

View GitHub Profile
User-agent: *
Allow: /
Disallow: /manager/
Disallow: /assets/components/
Disallow: /core/
Disallow: /connectors/
Disallow: /index.php
Disallow: /search
Disallow: /profile/
Disallow: *?*
@4e6ka
4e6ka / Проверка заполненности мета на modx
Created February 24, 2025 06:07
Проверка заполненности мета на modx
<table class="table table-border">
<tr>
<td>№</td>
<td>Ссылка и заголовок</td>
<td>seo title</td>
<td>seo description</td>
</tr>
[[!pdoPage?
&element=`pdoResources`
@4e6ka
4e6ka / Выборки modx json для where в pdoResources
Last active February 24, 2025 02:20
Выборки modx json для where в pdoResources
Формат записи фильтров в pdoResources — чистый JSONxPDO, т.к. для этого используется JSONxPDO-параметр &where:
Проверка по типу документа
&where=`{"class_key":"modDocument"}`
rtfm.modx.com/display/xPDO20/xPDOQuery.where
`{«tv1»:«5»}`
@4e6ka
4e6ka / ggl_parse_domains
Created February 24, 2025 02:15
ggl parse domains
const asyncInterval = async (callback, ms, triesLeft = 5) => {
return new Promise((resolve, reject) => {
const interval = setInterval(async () => {
if (await callback()) {
resolve();
clearInterval(interval);
} else if (triesLeft <= 1) {
reject();
clearInterval(interval);
}
@4e6ka
4e6ka / seo_meta_for_modx_revo.txt
Last active March 10, 2025 08:52
SEO optimal meta markup in head (modx revo)
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover">
<title>[[*seotitle:default=`[[*pagetitle]]`]] - [[++site_name]]</title>
<meta name="description" content="[[*introtext:default=`[[*pagetitle]]. Официальный дилер. Гарантия.`]]">
<meta name="keywords" content="ключевое слово 1, ключевое слово 2, ключевое слово 3">
<meta name="author" content="Название компании">
<meta name="robots" content="index, follow">
@4e6ka
4e6ka / gist:c59a39dfa2e4dd586e3b218d1dfedc98
Created October 10, 2024 05:53
Сниппет для кеширования чанка, для старого парсера modx revo
snippet cache_chunk
<?php
$cache_key = "chunk_".$name;
$output = $modx->cacheManager->get($cache_key);
if (empty($output)) {
$output = $modx->getChunk($name, $scriptProperties);
$modx->cacheManager->set($cache_key,$output);
@4e6ka
4e6ka / gist:f0f5f95ab98b4268b7082cfdf5713a96
Created May 22, 2024 16:41
Валидация полей форм
name:required:regexp=^/[^А-я]/^
phone:required:minLength=^7^
mess:antispam
g-recaptcha-response:required`
@4e6ka
4e6ka / YML_offer_turbo.xml
Last active March 12, 2024 11:26
YML for Yandex ADS
<offer id="[[+idx]]" available="true">
<name>[[+pagetitle]] [[+article]]</name>
<url>https://station-centre.ru/[[~[[+id]]]]</url>
<price from="true">[[!+price:replace=` ==`]]</price>
<vendor>vendor</vendor>
[[+old_price:gt=`[[+price:replace=` ==`]]`:then=`<oldprice>[[+old_price:replace=` ==`]]</oldprice>`:else=``]]
<currencyId>RUR</currencyId>
<available>true</available>
<sales_notes>delivery, other pros etc.</sales_notes>
<categoryId>[[+parent]]</categoryId>
@4e6ka
4e6ka / open graph for articles.html
Last active March 12, 2024 10:39
open graph for articles
<meta property="og:locale" content="ru_RU" />
<meta property="og:type" content="article">
<meta property="og:site_name" content="[[++site_url]]">
<meta property="og:title" content="[[*seotitle]]">
<meta property="article:section" content="[[#[[*parent]].longtitle]]">
<meta property="article:modified_time" content="[[*publishedon]]">
<meta property="og:url" content="[[*id:is=`1`:then=`https://giftforanyone.ru/`:else=`[[++site_url]][[*uri]]`]]">
<meta property="article:author" content="[[#[[*author]].pagetitle]]">
<meta property="og:description" content="[[*description:default=`[[If? &subject=`[[*description]]` &operator=`empty` &then=`[[*pagetitle]]` &else=`[[*longtitle]]`]]`]] extra content.">
<meta property="og:image" content="[[++site_url]][[*picture]]">
@4e6ka
4e6ka / modx revo meta seo.php
Last active March 12, 2024 10:05
modx revo meta seo
<meta charset="utf-8">
<title>[[*seotitle:default=`[[*pagetitle]]`]] - [[++site_name]]</title>
<meta name="description" content="[[*introtext:default=`[[*pagetitle]]. Официальный дилер. Гарантия.`]]">
<base href="[[!siteurl]]" />
<link rel="canonical" href="[[!siteurl]][[*url]]"/>