diff --git a/cache/securitylog.txt b/cache/securitylog.txt new file mode 100644 index 0000000..0e6d356 --- /dev/null +++ b/cache/securitylog.txt @@ -0,0 +1 @@ +127.0.0.1;2021-10-21 16:41:00;wrong captcha http://localhost/typemill/tm/login diff --git a/content/00-welcome/03-get-help.md b/content/00-welcome/03-get-help.md index 0d7de07..d6e256f 100644 --- a/content/00-welcome/03-get-help.md +++ b/content/00-welcome/03-get-help.md @@ -8,3 +8,5 @@ Do you need professional help, an individual theme or a special plugin? You can [Contributions](https://github.com/typemill/typemill#contributors--supporters), [donations](https://www.paypal.me/typemill) and [feedback](https://github.com/typemill/typemill/issues) for this open source project are always welcome. +![alt](media/live/youtube-6i2-uv88gke.jpeg){.center loading="lazy"} + diff --git a/system/Controllers/ControllerAuthorArticleApi.php b/system/Controllers/ControllerAuthorArticleApi.php index 52e9e4f..d021346 100644 --- a/system/Controllers/ControllerAuthorArticleApi.php +++ b/system/Controllers/ControllerAuthorArticleApi.php @@ -98,7 +98,7 @@ class ControllerAuthorArticleApi extends ControllerAuthor $this->setFreshNavigation(); # update the sitemap - $this->updateSitemap(); + $this->updateSitemap($ping = true); # complete the page meta if title or description not set $writeMeta = new WriteMeta(); @@ -518,7 +518,7 @@ class ControllerAuthorArticleApi extends ControllerAuthor $this->setFreshStructureDraft(); $this->setFreshStructureLive(); $this->setFreshNavigation(); - $this->updateSitemap(); + $this->updateSitemap($ping = true); $newUrlRel = str_replace($this->item->slug, $this->params['slug'], $this->item->urlRelWoF); @@ -591,6 +591,9 @@ class ControllerAuthorArticleApi extends ControllerAuthor # if the item has been moved within the same folder if($this->params['parent_id_from'] == $this->params['parent_id_to']) { + # no need to ping search engines + $ping = false; + # get key of item $itemKey = end($itemKeyPath); reset($itemKeyPath); @@ -600,6 +603,9 @@ class ControllerAuthorArticleApi extends ControllerAuthor } else { + # let us ping search engines + $ping = true; + # rename links in extended file $this->renameExtended($item, $newFolder); @@ -644,7 +650,7 @@ class ControllerAuthorArticleApi extends ControllerAuthor $this->setFreshNavigation(); # update the sitemap - $this->updateSitemap(); + $this->updateSitemap($ping); # dispatch event $this->c->dispatcher->dispatch('onPageSorted', new OnPageSorted($this->params)); diff --git a/system/Controllers/ControllerSettings.php b/system/Controllers/ControllerSettings.php index 9f6eeda..cbb4df4 100644 --- a/system/Controllers/ControllerSettings.php +++ b/system/Controllers/ControllerSettings.php @@ -120,6 +120,7 @@ class ControllerSettings extends ControllerShared 'securitylog' => isset($newSettings['securitylog']) ? true : null, 'oldslug' => isset($newSettings['oldslug']) ? true : null, 'refreshcache' => isset($newSettings['refreshcache']) ? true : null, + 'pingsitemap' => isset($newSettings['pingsitemap']) ? true : null, ); # https://www.slimframework.com/docs/v3/cookbook/uploading-files.html; diff --git a/system/Controllers/ControllerShared.php b/system/Controllers/ControllerShared.php index 3309388..65df936 100644 --- a/system/Controllers/ControllerShared.php +++ b/system/Controllers/ControllerShared.php @@ -275,7 +275,7 @@ abstract class ControllerShared return true; } - public function updateSitemap() + public function updateSitemap($ping = false) { $sitemap = '' . "\n"; $sitemap .= '' . "\n"; @@ -284,6 +284,27 @@ abstract class ControllerShared $sitemap .= ''; $this->writeCache->writeFile('cache', 'sitemap.xml', $sitemap); + + if($ping && isset($this->settings['pingsitemap']) && $this->settings['pingsitemap']) + { + $sitemapUrl = $this->uri->getBaseUrl() . '/cache/sitemap.xml'; + + $pingGoogleUrl = 'http://www.google.com/ping?sitemap=' . urlencode($sitemapUrl); + $pingBingUrl = 'http://www.bing.com/ping?sitemap=' . urlencode($sitemapUrl); + + $opts = array( + 'http'=>array( + 'method'=>"GET", + 'timeout' => 5 + ) + ); + + $context = stream_context_create($opts); + + $resultBing = file_get_contents($pingBingUrl, false, $context); + $resultGoogle = file_get_contents($pingGoogleUrl, false, $context); + } + } public function generateUrlSets($structureLive) diff --git a/system/Extensions/ParsedownExtension.php b/system/Extensions/ParsedownExtension.php index ca9ccdb..5886452 100644 --- a/system/Extensions/ParsedownExtension.php +++ b/system/Extensions/ParsedownExtension.php @@ -200,6 +200,20 @@ class ParsedownExtension extends \ParsedownExtra return $block; } + protected function inlineImage($excerpt) + { + $image = parent::inlineImage($excerpt); + + if ( ! isset($image)) + { + return null; + } + + $image['element']['attributes']['loading'] = "lazy"; + + return $image; + } + protected function blockTable($Line, array $Block = null) { diff --git a/system/Settings.php b/system/Settings.php index fd4c123..7cbdc1b 100644 --- a/system/Settings.php +++ b/system/Settings.php @@ -193,6 +193,7 @@ class Settings 'securitylog' => true, 'oldslug' => true, 'refreshcache' => true, + 'pingsitemap' => true, ]; # cleanup the existing usersettings diff --git a/system/author/js/vue-blox.js b/system/author/js/vue-blox.js index 69ea52c..9620996 100644 --- a/system/author/js/vue-blox.js +++ b/system/author/js/vue-blox.js @@ -1604,7 +1604,7 @@ const imageComponent = Vue.component('image-component', { imgmarkdown = imgmarkdown + '(' + this.imgfile + ')'; } - var imgattr = ''; + var imgattr = 'loading="lazy" '; if(this.imgid != '') { if(this.imgid.length < 100) diff --git a/system/author/metatabs.yaml b/system/author/metatabs.yaml index e96e768..d6583fa 100644 --- a/system/author/metatabs.yaml +++ b/system/author/metatabs.yaml @@ -1,19 +1,10 @@ meta: fields: - fieldsetnavi: - type: fieldset - legend: Navigation - fields: - navtitle: - type: text - label: Navigation Title - class: medium - maxlength: 60 - hide: - type: checkbox - label: Hide - checkboxlabel: Hide page from navigation - class: medium + navtitle: + type: text + label: Navigation Title + class: large + maxlength: 60 fieldsetcontent: type: fieldset legend: Meta-Content @@ -36,6 +27,20 @@ meta: heroimagealt: type: text label: Alternative Text for the hero image + fieldsetvisibility: + type: fieldset + legend: Visibility + fields: + hide: + type: checkbox + label: Hide + checkboxlabel: Hide page from navigation + class: medium + nofollow: + type: checkbox + label: Nofollow + checkboxlabel: Add no-follow and exclude from sitemap + class: medium fieldsetauthor: type: fieldset legend: Author diff --git a/system/author/settings/system.twig b/system/author/settings/system.twig index 29515ff..92692c2 100644 --- a/system/author/settings/system.twig +++ b/system/author/settings/system.twig @@ -20,7 +20,7 @@
{{ settings.version ? settings.version : 'Unknown' }}
- +
@@ -71,6 +71,13 @@
+
You can ping the sitemap with the following links to google and bing.
+
+ +