Skip to content

Commit 2db495f

Browse files
Merge pull request #11 from magefan/7455-module-html-sitemap
7455-module-html-sitemap [fixed templates]
2 parents 453466e + a3e35da commit 2db495f

File tree

12 files changed

+97
-188
lines changed

12 files changed

+97
-188
lines changed

view/frontend/templates/additional/additional.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $links = $block->getAllLinksArray();
1313
?>
1414
<div class="sitemap-item-type sitemap-item-section">
1515
<?php if (count($links)): ?>
16-
<br>
16+
1717
<?php foreach ($links as $link): ?>
1818
<?php if ($link): ?>
1919
<a href="<?= $block->escapeUrl($block->getBaseUrl() . $link['url']) ?>" title="<?= $block->escapeHtml($link['title']) ?>">

view/frontend/templates/blog/post.phtml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
?>
1111
<div class="sitemap-item-type sitemap-item-section">
12-
<br>
12+
1313
<?php
1414
$lettersArray = range('A', 'Z');
1515
$lettersArray[] = '#';
@@ -34,34 +34,14 @@
3434
<strong><?= $block->escapeHtml($letter); ?></strong>
3535
</p>
3636

37-
<?php
38-
$ulLimit = ceil(count($postsArray)/4);
39-
$liCount = 0;
40-
$i = 0;
41-
?>
42-
<table>
43-
<tr>
44-
<?php foreach ($postsArray as $post) {
45-
if ($liCount == 0) { ?>
46-
<th>
47-
<ul style="list-style-type:none">
48-
<?php } ?>
49-
<li>
50-
<a href="<?= $block->escapeUrl($post['url']) ?>" title="<?= $block->escapeHtml($post['name']) ?>">
51-
<?= $block->escapeHtml($post['name']) ?>
52-
</a>
53-
</li>
54-
<?php
55-
$liCount++;
56-
$i++;
57-
if ($liCount == $ulLimit || $i == count($postsArray)) { ?>
58-
</ul>
59-
</th>
60-
<?php $liCount = 0; ?>
61-
<?php } ?>
62-
<?php } ?>
63-
</tr>
64-
</table>
37+
<div class="sitemap-item-wrap">
38+
<?php foreach ($postsArray as $post): ?>
39+
<a class="sitemap-item" href="<?= $block->escapeUrl($post['url']) ?>" title="<?= $block->escapeHtml($post['name']) ?>">
40+
<?= $block->escapeHtml($post['name']) ?>
41+
</a>
42+
<?php endforeach; ?>
43+
</div>
44+
6545
</div>
6646
<?php endforeach; ?>
6747
</div>

view/frontend/templates/catalog/category.phtml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
?>
1111
<div class="sitemap-item-type sitemap-item-section">
12-
<br>
12+
1313
<?php $items = $block->getAllGroupedChildes(); ?>
1414

1515
<?php if (count($items)) { ?>
@@ -45,11 +45,6 @@
4545
?>
4646
</div>
4747
</div>
48-
<style>
49-
.htmlsitemap-catalog_category-categories .widget.block-categories ul li {
50-
padding: 0 0 0 15px;
51-
}
52-
</style>
5348
<?php } ?>
5449
</div>
5550

view/frontend/templates/catalog/product.phtml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
* @var $block \Magefan\HtmlSitemap\Block\Catalog\Product
99
*/
1010
?>
11+
1112
<div class="sitemap-item-type sitemap-item-section">
12-
<br>
13+
1314
<?php
1415
$lettersArray = range('A', 'Z');
1516
$lettersArray[] = '#';
@@ -34,33 +35,11 @@
3435
<strong><?= $block->escapeHtml($letter); ?></strong>
3536
</p>
3637

37-
<?php
38-
$ulLimit = ceil(count($productsArray)/4);
39-
$liCount = 0;
40-
$i = 0;
41-
?>
42-
<table>
43-
<tr>
44-
<?php foreach ($productsArray as $product) {
45-
if ($liCount == 0) { ?>
46-
<th>
47-
<ul style="list-style-type:none">
48-
<?php } ?>
49-
<li>
50-
<a href="<?= $block->escapeUrl($product['url']) ?>" title="<?= $block->escapeHtml($product['name']) ?>"><?= $block->escapeHtml($product['name']) ?></a>
51-
</li>
52-
<?php
53-
$liCount++;
54-
$i++;
55-
if ($liCount == $ulLimit || $i == count($productsArray)) { ?>
56-
</ul>
57-
</th>
58-
<?php $liCount = 0; ?>
59-
<?php } ?>
60-
<?php }
61-
?>
62-
</tr>
63-
</table>
38+
<div class="sitemap-item-wrap">
39+
<?php foreach ($productsArray as $product): ?>
40+
<a href="<?= $block->escapeUrl($product['url']) ?>" title="<?= $block->escapeHtml($product['name']) ?>"><?= $block->escapeHtml($product['name']) ?></a>
41+
<?php endforeach; ?>
42+
</div>
6443
</div>
6544
<?php } ?>
6645
</div>

view/frontend/templates/cms/page.phtml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
*/
1010
?>
1111
<div class="sitemap-item-type sitemap-item-section">
12-
<br>
13-
<?php foreach ($block->getCmsPagesList() as $page): ?>
14-
<a href="<?= $block->escapeUrl($block->getBaseUrl() . $page->getIdentifier()) ?>" title="<?= $block->escapeHtml($page['title']) ?>">
15-
<?= $block->escapeHtml($page['title']) ?>
16-
</a>
17-
<?php endforeach; ?>
12+
<div class="sitemap-item-wrap">
13+
<?php foreach ($block->getCmsPagesList() as $page): ?>
14+
<a class="sitemap-item" href="<?= $block->escapeUrl($block->getBaseUrl() . $page->getIdentifier()) ?>" title="<?= $block->escapeHtml($page['title']) ?>">
15+
<?= $block->escapeHtml($page['title']) ?>
16+
</a>
17+
<?php endforeach; ?>
18+
</div>
1819
<?php if ($pages = $block->getPagerHtml()): ?>
1920
<div class="order-products-toolbar toolbar bottom"><?= $pages ?></div>
2021
<?php endif ?>

view/frontend/templates/general.phtml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,51 @@
55
*/
66
?>
77

8-
<div class="container">
8+
<div class="sitemap-search">
99
<input id="html-sitemap-search" placeholder="Search" style="border-radius: 15px; padding: 15px;" type="text"/>
1010
</div>
1111

1212
<style>
13-
.sitemap-item-type {
14-
display: inline-block;
15-
width: 100%;
16-
overflow-x: auto;
13+
/* Layout **********/
14+
[class*="htmlsitemap-"] .page-main {padding-left: 20px;padding-right: 20px;}
15+
[class*="htmlsitemap-"] .sitemap-item-type {font-size: 14px;}
16+
17+
/* Sitemap Index **********/
18+
/* Search */
19+
.sitemap-search {margin-bottom: 30px;}
20+
.sitemap-search input {width: 100%;height: 40px;font-size: 14px;border: 1px solid #c2c2c2;}
21+
22+
.htmlsitemap-index-index .sitemap-item-type {margin-bottom: 40px;}
23+
.htmlsitemap-index-index .sitemap-item-type > h2 {margin: 0 0 20px;}
24+
.htmlsitemap-index-index .sitemap-item-type .highlight-result {color: red;}
25+
26+
/* Category */
27+
[class*="htmlsitemap-"] .widget.block-categories .accordion {margin-bottom: 20px;}
28+
[class*="htmlsitemap-"] .widget.block-categories ul li {padding: 0 0 0 15px;}
29+
[class*="htmlsitemap-"] .widget.block-categories ul li a {display: inline-block;font-size: 14px;padding: 5px;font-weight: 400;}
30+
31+
/* Grid Items ***********/
32+
[class*="htmlsitemap-"] .sitemap-item-wrap {display: grid;grid-column-gap: 20px;grid-row-gap: 10px;grid-template-columns: repeat(4, 1fr);margin-bottom: 20px;}
33+
[class*="htmlsitemap-"] .sitemap-item-type a {font-size: 14px;}
34+
[class*="htmlsitemap-"] .sitemap-item-type a:hover {text-decoration: underline;}
35+
[class*="htmlsitemap-"] .sitemap-item-wrap .sitemap-item {font-size: 14px;}
36+
[class*="htmlsitemap-"] .sitemap-item-wrap .sitemap-item:hover {text-decoration: underline;}
37+
[class*="htmlsitemap-"] .sitemap-item-type .view-more {display: inline-block;color: red;margin-top: 0;margin-left: 0;}
38+
39+
@media (max-width: 1023px) {
40+
[class*="htmlsitemap-"] .sitemap-item-wrap {display: grid;grid-gap: 10px;grid-template-columns: repeat(3, 1fr);}
1741
}
18-
19-
.sitemap-col {
20-
display: block;
21-
width: 25%;
22-
float: left;
23-
padding-bottom: 20px;
24-
}
25-
26-
.sitemap-item-type a {
27-
display: block;
28-
padding: 5px;
29-
}
30-
31-
@media screen and (max-width: 400px) {
32-
.sitemap-col {
33-
width: 100%;
34-
}
35-
36-
.sitemap-col {
37-
padding-bottom: 0;
38-
}
42+
@media (max-width: 767px) {
43+
[class*="htmlsitemap-"] .sitemap-item-wrap {display: grid;grid-gap: 10px;grid-template-columns: repeat(2, 1fr);}
3944
}
40-
41-
@media screen and (min-width: 401px) and (max-width: 768px) {
42-
.sitemap-col {
43-
width: 50%;
44-
}
45+
@media (max-width: 575px) {
46+
[class*="htmlsitemap-"] .sitemap-item-wrap {display: grid;grid-gap: 10px;grid-template-columns: 1fr;}
4547
}
4648

47-
.highlight-result {
48-
color: red;
49-
}
50-
.htmlsitemap-index-index .widget.block-categories ul li {
51-
padding: 0 0 0 15px;
52-
}
49+
/* Products */
50+
[class*="htmlsitemap-"] .sitemap-item-type .sitemap-item-section {margin-bottom: 20px;}
51+
[class*="htmlsitemap-"] .sitemap-item-type .sitemap-item-section > p {margin-bottom: 10px;}
52+
[class*="htmlsitemap-"] .sitemap-item-type .sitemap-item-section .sitemap-item-wrap {padding-left: 40px;}
5353

5454
</style>
5555

view/frontend/templates/index/additional_additional.phtml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,22 @@
1010
*/
1111

1212
$links = $block->getLinksArray();
13-
$limit = 4;
14-
$i = 0;
15-
$j = 0;
1613
?>
14+
1715
<?php if (count($links)): ?>
1816
<div class="sitemap-item-type sitemap-item-section">
19-
<h2><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
20-
<br>
21-
<?php foreach ($links as $link): ?>
17+
<h2 class="sitemap-title"><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
18+
<div class="sitemap-item-wrap">
19+
<?php foreach ($links as $link): ?>
2220
<?php if ($link): ?>
23-
<?= ($i === 0) ? '<div class="sitemap-col">' : '' ?>
24-
<a href="<?= $block->escapeUrl($block->getBaseUrl() . $link['url'])?>" title="<?= $block->escapeHtml($link['title'])?>">
25-
<?= $block->escapeHtml($link['title'])?>
26-
</a>
27-
<?= ($i === $limit-1 || count($links)-1 == $j) ? '</div>' : '' ?>
28-
<?php
29-
$i++;
30-
$j++;
31-
32-
if ($i === $limit) {
33-
$i = 0;
34-
}
35-
?>
21+
<a class="sitemap-item" href="<?= $block->escapeUrl($block->getBaseUrl() . $link['url'])?>" title="<?= $block->escapeHtml($link['title'])?>">
22+
<?= $block->escapeHtml($link['title'])?>
23+
</a>
3624
<?php endif; ?>
3725
<?php endforeach; ?>
26+
</div>
3827
<?php if ($block->showViewMore()): ?>
39-
<a href="<?= $block->escapeUrl($block->getUrl('*/additional/links'))?>" style="color: red; padding: 5px;">
28+
<a class="view-more" href="<?= $block->escapeUrl($block->getUrl('*/additional/links'))?>">
4029
<?= $block->escapeHtml(__('View more'))?>
4130
</a>
4231
<?php endif; ?>

view/frontend/templates/index/blog_category.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
$items = $block->getGroupedChildes();
1313
?>
14+
1415
<?php if (count($items)) { ?>
1516
<div class="sitemap-item-type sitemap-item-section">
1617
<h2><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
17-
<br />
1818
<div class="widget block block-categories" data-bind="scope: 'categories'">
1919
<div class="accordion" id="accordion-2">
2020
<?php
@@ -48,7 +48,7 @@ $items = $block->getGroupedChildes();
4848
?>
4949
</div>
5050
<?php if ($block->showViewMore()): ?>
51-
<a href="<?= $block->escapeUrl($block->getUrl('*/blog_category/categories'))?>" style="color: red; padding: 5px;">
51+
<a class="view-more" href="<?= $block->escapeUrl($block->getUrl('*/blog_category/categories'))?>">
5252
<?= $block->escapeHtml(__('View more'))?>
5353
</a>
5454
<?php endif; ?>

view/frontend/templates/index/blog_post.phtml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,20 @@
1010
*/
1111

1212
$posts = $block->getPostsCollection();
13-
$limit = 4;
14-
$i = 0;
15-
$j = 0;
1613
?>
14+
1715
<?php if (count($posts)) { ?>
1816
<div class="sitemap-item-type sitemap-item-section">
19-
<h2><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
20-
<br>
17+
<h2 class="sitemap-title"><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
18+
<div class="sitemap-item-wrap">
2119
<?php foreach ($posts as $post): ?>
22-
<?= ($i === 0) ? '<div class="sitemap-col">' : '' ?>
23-
<a href="<?= $block->escapeUrl($post->getPostUrl()) ?>" title="<?= $block->escapeHtml($post->getTitle()) ?>">
24-
<?= $block->escapeHtml($post->getTitle()) ?>
25-
</a>
26-
27-
<?= ($i === $limit-1 || count($posts)-1 == $j) ? '</div>' : '' ?>
28-
<?php
29-
$i++;
30-
$j++;
31-
32-
if ($i === $limit) {
33-
$i = 0;
34-
}
35-
?>
20+
<a class="sitemap-item" href="<?= $block->escapeUrl($post->getPostUrl()) ?>" title="<?= $block->escapeHtml($post->getTitle()) ?>">
21+
<?= $block->escapeHtml($post->getTitle()) ?>
22+
</a>
3623
<?php endforeach; ?>
24+
</div>
3725
<?php if ($block->showViewMore()): ?>
38-
<a href="<?= $block->escapeUrl($block->getUrl('*/blog_post/post'))?>" style="color: red; padding: 5px;">
26+
<a class="view-more" href="<?= $block->escapeUrl($block->getUrl('*/blog_post/post'))?>" style="color: red; padding: 5px;">
3927
<?= $block->escapeHtml(__('View more'))?>
4028
</a>
4129
<?php endif; ?>

view/frontend/templates/index/catalog_category.phtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ $items = $block->getGroupedChildes();
1313
?>
1414
<?php if (count($items)) { ?>
1515
<div class="sitemap-item-type sitemap-item-section">
16-
<h2><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
17-
<br />
16+
<h2 class="sitemap-title"><?= $block->escapeHtml(__($block->getBlockTitle())) ?></h2>
1817
<div class="widget block block-categories" data-bind="scope: 'categories'">
1918
<div class="accordion" id="accordion-2">
2019
<?php
@@ -47,7 +46,7 @@ $items = $block->getGroupedChildes();
4746
?>
4847
</div>
4948
<?php if ($block->showViewMore()): ?>
50-
<a href="<?= $block->escapeUrl($block->getUrl('*/catalog_category/categories'))?>" style="color: red; padding: 5px;">
49+
<a class="view-more" href="<?= $block->escapeUrl($block->getUrl('*/catalog_category/categories'))?>" style="color: red; padding: 5px;">
5150
<?= $block->escapeHtml(__('View more'))?>
5251
</a>
5352
<?php endif; ?>

0 commit comments

Comments
 (0)