1
0
Fork 0

[FIX] get masonry to initialize properly

This commit is contained in:
Jannik Beyerstedt 2021-01-30 22:56:09 +01:00
parent 0762dd0294
commit 2d714c2393
4 changed files with 105 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
../../../modules/kirby-template-sitemap/blueprints/xmlsitemap.yml

View file

@ -0,0 +1,37 @@
title: XML Sitemap
options:
changeStatus: false
changeTempate: false
changeSlug: false
delete: false
changeTitle: false
columns:
main:
width: 2/3
sections:
content:
type: fields
fields:
info:
type: info
text: >
This site generates a html-base sitemap (a human readable one).
<br>
You should probably set some of the following options in the config.php
<br>
<pre>c::set('smap_ignoreSite', array(...));</pre>
<pre>c::set('smap_ignoreTemplate', array(...));</pre>
For more information see the readme.
sidebar:
width: 1/3
sections:
pages: false
files: false

View file

@ -44,14 +44,19 @@ echo js('assets/vendors/bootstrap/js/dist/carousel.js');
</style>
<?php echo js('assets/vendors/masonry/dist/masonry.pkgd.min.js');?>
<?php echo js('assets/vendors/imagesloaded.pkgd.min.js');?>
<script type="text/javascript" nonce="nRfqpuKWNuYyUAFPTr6WVNZk9">
$('#masonry').masonry({
isFitWidth: true,
var $grid = $('#masonry').masonry({
fitWidth: true,
columnWidth: <?php echo c::get('plg_masonry.width') ?>,
gutter: 10,
itemSelector: '.masonryitem'
});
// layout Masonry after each image loads
$grid.imagesLoaded().progress( function() {
$grid.masonry('layout');
});
</script>
<?php echo js('assets/vendors/swipebox/src/js/jquery.swipebox.min.js');?>

View file

@ -1 +0,0 @@
../../modules/kirby-template-sitemap/templates/xmlsitemap.php

54
site/templates/xmlsitemap.php Executable file
View file

@ -0,0 +1,54 @@
<?php
// -------------------------------------------
// kirby template FOR all
// Title: xmlsitemap
// deltas: none - base template
// better sitemap for sites containing onepagers:
// exclude pages from sitemap by intended Template (content file name)
// so You can exclude the templates, that are only for blueprints or for selecting snippets.
// copyright: Jannik Beyerstedt | http://jannikbeyerstedt.de | code@jannikbeyerstedt.de
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
// usage:
// see the readme.md contained in the repository
// version: 1.2.1 (14.10.2016)
// changelog:
// v1.1.0: set ignore arrays in config
// v1.2.0: exclude invisible pages
// v1.2.1: new option to switch exclusion of invisible pages at root level
// -------------------------------------------
$ignore = c::get('smap_ignoreSite');
$ignoreTemplate = c::get('smap_ignoreTemplate');
$ignoreShowInvisibleAtRoot = c::get('smap_showHiddenPagesAtRootLevel', false);
// send the right header
header('Content-type: text/xml; charset="utf-8"');
// echo the doctype
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach($pages->index() as $p):
if($ignore !== null && in_array($p->uri(), $ignore)) continue;
if($ignoreTemplate !== null && in_array($p->intendedTemplate(), $ignoreTemplate) ) continue;
if($ignoreShowInvisibleAtRoot) {
// only ignore invisible pages, which are deeper than root level
if($p->isUnlisted() && $p->depth() > 1) continue;
} else {
// ignore all invisible pages
if($p->isUnlisted() && $p->isHomePage() === false) continue;
}
?>
<url>
<loc><?php echo html($p->url()) ?></loc>
<lastmod><?php echo $p->modified('c') ?></lastmod>
<priority><?php echo ($p->isHomePage()) ? 1 : number_format(0.5/$p->depth(), 1) ?></priority>
</url>
<?php endforeach ?>
</urlset>