File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 10
10
11
11
use Magento \Framework \App \ProductMetadataInterface ;
12
12
use Magefan \Blog \Api \SitemapConfigInterface ;
13
+ use Magento \Store \Model \ScopeInterface ;
13
14
14
15
/**
15
16
* Deprecated
@@ -32,6 +33,26 @@ protected function _initSitemapItems()
32
33
33
34
$ sitemapItems = [];
34
35
if ($ sitemapConfig ->isEnabledSitemap (SitemapConfigInterface::HOME_PAGE )) {
36
+
37
+ $ url = $ objectManager ->get (\Magefan \Blog \Model \Url::class)->getBasePath ();
38
+
39
+ $ scopeConfig = $ objectManager ->get (\Magento \Framework \App \Config \ScopeConfigInterface::class);
40
+ $ advancedPermalinkEnabled = $ scopeConfig ->getValue (
41
+ Config::XML_PATH_ADVANCED_PERMALINK_ENABLED ,
42
+ ScopeInterface::SCOPE_STORE
43
+ );
44
+
45
+ if (!$ advancedPermalinkEnabled ) {
46
+ $ redirectToNoSlash = $ scopeConfig ->getValue (
47
+ Config::XML_PATH_REDIRECT_TO_NO_SLASH ,
48
+ ScopeInterface::SCOPE_STORE
49
+ );
50
+
51
+ if (!$ redirectToNoSlash ) {
52
+ $ url = trim ($ url , '/ ' ) . '/ ' ;
53
+ }
54
+ }
55
+
35
56
$ sitemapItems [] = new \Magento \Framework \DataObject (
36
57
[
37
58
'changefreq ' => $ sitemapConfig ->getFrequency (SitemapConfigInterface::HOME_PAGE ),
@@ -43,7 +64,7 @@ protected function _initSitemapItems()
43
64
\Magento \Framework \DataObject::class
44
65
)->setData ([
45
66
'updated_at ' => '' ,
46
- 'url ' => $ objectManager -> get (\ Magefan \ Blog \ Model \Url::class)-> getBasePath () ,
67
+ 'url ' => $ url ,
47
68
])
48
69
)
49
70
]
You can’t perform that action at this time.
0 commit comments