I want to move page.main.title block to my breadcrumbs container, not before or after it, I want to push it inside breadcrumbs template and remove other wheres.
So this is my ~/Magento_Theme/templates/html/header/breadcrumbs.phtml :
<div class="container">
<div class="breadcrumbs">
<span class="current-name">
<?php
/*** I NEED PAGE.MAIN.TITLE BLOCK HERE ***/
?>
</span>
<ul class="items">
<?php /* showing breadcrumb items */ ?>
</ul>
</div>
</div>
in above template in .current-name class I need the title block!
I did this in ~/Magento_Theme/layout/default.xml, but it goes before breadcrumbs block not inside it:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="page.main.title" destination="page.top" before="breadcrumbs"/>
<referenceContainer name="page.top">
<block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</referenceContainer>
</body>
</page>
and I did this in breadcrumbs.phtml too, It works perfectly but the Title exists in other wheres and I have 2 <h1>
tag in my page, so that is wrong!:
echo $block->getBlockHtml('page.main.title');
and I want to use this block(page.main.title) for showing my title Because of SEO stuff and I think this is the proper way! not the bad ways like show title from latest crumb label in loop or anything like that!
Note that the '~' character above is pointing my theme folder (app/design/frontend/MyVendor/myTheme
).
Note that I'm using Magento 2.1.9
with PHP 7.0.24
.