Magento2: Unable to change Contacts Page <title>-Tag with XML

Created on 24 Jun 2016  路  11Comments  路  Source: magento/magento2

Dear community,

I think I may found something unwanted.

Theres a layout default.xml for the contact page in

vendor/magento/module-contact/view/layout/ => default.xml
Line 13:
<argument name="label" xsi:type="string" translate="true">Contact Us</argument>

When I make an duplicate of this file and copy it to

app/design/frontend/ThemeName/Namespace/Magento_Contact/layout/ => default.xml

and change the line from "Contact us" to something else, the changes make no change in the -Tag of the page itself. </p> <p>Is this intended or a bug, or am I just simply doing something wrong here. What I want to do is to change the <title>-Tag of the contact page, since its not translateable over the backend right now.</p> <p>This could be a feature in future releases, in order to keep Magento translateable. </p> </div> <div> <span class="badge badge-primary">Cannot Reproduce</span> <span class="badge badge-primary">Clear Description</span> <span class="badge badge-primary">Format is not valid</span> <span class="badge badge-primary">Ready for Work</span> <span class="badge badge-primary">bug report</span> <div class="float-right"> <a class="text-muted" href="https://www.github.com/magento/magento2/issues/5231" rel="nofollow noreferrer" target="_blank" onclick="dataLayer.push({'event': 'GAEvent', 'eventCategory': 'click', 'eventAction': 'source_bottom', 'eventLabel': 'Source Bottom', 'eventValue': undefined});">Source</a> </div> </div> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars0.githubusercontent.com/u/13021579?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt=" picture"> <strong>grasdaggel</strong> </div> <div class="col text-right"> </div> </div> </div> </div> </div> <div class="col-12"> <div id="ph-above-best-comment"> </div> </div> <div class="col-12 mb-4 best-comment"> <div> <h2 class="mb-3"><i class="fas fa-check mr-2"></i>Most helpful comment</h2> </div> <div class="card card-custom border-lg-success mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>Hello @valeriaabo<br /> You can change it using override Magento\Contact\Block\ContactForm and add code like below </p> <p>CustomModule/Module/etc/di.xml<br /> <code><?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Contact\Block\ContactForm" type="CustomModule\Module\Block\ContactUs\ContactForm" /> </config></code> </p> <p>CustomModule/Module/Block/ContactUs/ContactForm.php </p> <blockquote> <p><?php<br /> namespace CustomModuleModule\Block\ContactUs;<br /> use Magento\Framework\View\Element\Template;<br /> class ContactForm extends Magento\Contact\Block\ContactForm<br /> {<br /> public function _prepareLayout()<br /> {<br /> $this->pageConfig->getTitle()->set(__('Contact Us')); // add title here<br /> }<br /> }</p> </blockquote> <p>This is works for me<br /> Let me know if any</p> <p>Thanks,<br /> Anant Prajapati</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars2.githubusercontent.com/u/5631358?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt=" picture"> <strong>Anantkprajapati</strong> <span class="text-muted ml-1">on 29 Apr 2018</span> </div> <div class="col text-right"> 👍<span class="ml-2 mr-3">3</span> </div> </div> </div> </div> </div> <div class="col-12"> <div class="mb-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="9295564578" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="col-12 d-flex align-items-center mb-4"> <h2>All 11 comments</h2> </div> <div class="col-12"> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>@grasdaggel<br /> Thank you for reporting this issue!<br /> To allow us research the issue, please, provide the used version and description according to the template.</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars0.githubusercontent.com/u/1677746?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="andimov picture"> <strong>andimov</strong> <span class="text-muted ml-1">on 24 Jun 2016</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>We are using Magento 2.0.4</p> <h2>Steps to reproduce</h2> <ol> <li>copy file "default.xml" to /app/design/Theme/Name/Magento_Contact/layout/</li> <li>Change the labels content from "Contact Us" to something else</li> <li>rm -rf var/page_cache var/cache var/view_preprocessed pub/static/*</li> <li>php bin/magento <a rel="nofollow noopener" target="_blank" href="setup:static-content">setup:static-content</a>:deploy de_DE en_US</li> <li>Check /contact</li> </ol> <h2>Expected result</h2> <ol> <li>Title changes from "Contact Us" to something else</li> </ol> <h2>Actual result</h2> <ol> <li>Title stays the same ("Contact Us")</li> </ol> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars0.githubusercontent.com/u/13021579?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="grasdaggel picture"> <strong>grasdaggel</strong> <span class="text-muted ml-1">on 25 Jun 2016</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>I've created an internal ticket MAGETWO-58021 for this issue and linked it to this one.</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars0.githubusercontent.com/u/1677746?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="andimov picture"> <strong>andimov</strong> <span class="text-muted ml-1">on 2 Sep 2016</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>Any update on this? Its been a while. </p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars0.githubusercontent.com/u/13021579?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="grasdaggel picture"> <strong>grasdaggel</strong> <span class="text-muted ml-1">on 21 Oct 2016</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>Hello <strong>@grasdaggel</strong>,</p> <p>You should create a <code>contact_index_index.xml</code> file into your layout folder.</p> <p>Then, change the title in it:</p> <pre><code class="prettyprint"><?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <title>New contact page title</title> </head> </page> </code></pre> <p>BUT you won't be able to translate it, the issue #2951 is still open and is talking about this bug.</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars0.githubusercontent.com/u/1949412?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="VincentMarmiesse picture"> <strong>VincentMarmiesse</strong> <span class="text-muted ml-1">on 28 May 2017</span> </div> <div class="col text-right"> 👍<span class="ml-2 mr-3">1</span> </div> </div> </div> </div> <div class="mb-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3731713875" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>I have tried to change the page title of the Contacts page on Magento 2.2 with XML and it still not working. This issue has been open for over 1 year. When is it going to be fixed?</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars1.githubusercontent.com/u/10808588?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="bondimedical3 picture"> <strong>bondimedical3</strong> <span class="text-muted ml-1">on 10 Oct 2017</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p><strong>@grasdaggel</strong>, thank you for your report.<br /> We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.<br /> We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars1.githubusercontent.com/u/31669971?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="magento-engcom-team picture"> <strong>magento-engcom-team</strong> <span class="text-muted ml-1">on 24 Oct 2017</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p><strong>@grasdaggel</strong>, thank you for your report.<br /> We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.<br /> We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars1.githubusercontent.com/u/31669971?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="magento-engcom-team picture"> <strong>magento-engcom-team</strong> <span class="text-muted ml-1">on 25 Oct 2017</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>Any solution?</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars3.githubusercontent.com/u/29784816?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="valeriaabo picture"> <strong>valeriaabo</strong> <span class="text-muted ml-1">on 5 Apr 2018</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p>Hello @valeriaabo<br /> You can change it using override Magento\Contact\Block\ContactForm and add code like below </p> <p>CustomModule/Module/etc/di.xml<br /> <code><?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Contact\Block\ContactForm" type="CustomModule\Module\Block\ContactUs\ContactForm" /> </config></code> </p> <p>CustomModule/Module/Block/ContactUs/ContactForm.php </p> <blockquote> <p><?php<br /> namespace CustomModuleModule\Block\ContactUs;<br /> use Magento\Framework\View\Element\Template;<br /> class ContactForm extends Magento\Contact\Block\ContactForm<br /> {<br /> public function _prepareLayout()<br /> {<br /> $this->pageConfig->getTitle()->set(__('Contact Us')); // add title here<br /> }<br /> }</p> </blockquote> <p>This is works for me<br /> Let me know if any</p> <p>Thanks,<br /> Anant Prajapati</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars2.githubusercontent.com/u/5631358?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="Anantkprajapati picture"> <strong>Anantkprajapati</strong> <span class="text-muted ml-1">on 29 Apr 2018</span> </div> <div class="col text-right"> 👍<span class="ml-2 mr-3">3</span> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p><strong>@Anantkprajapati</strong> : your solution worked very fine for me, thank you very much ! </p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars3.githubusercontent.com/u/26012756?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="AnthonyBonnier picture"> <strong>AnthonyBonnier</strong> <span class="text-muted ml-1">on 28 Jan 2019</span> </div> <div class="col text-right"> </div> </div> </div> </div> </div> <div class="col-12"> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown text-center helpful"> <div class="title">Was this page helpful?</div> <div class="mt-1" onMouseLeave="rating(162166032, 0);"> <i class="fas fa-star inactive" id="star-1" onMouseOver="rating(162166032, 1);" onclick="rate(162166032, 1);"></i> <i class="fas fa-star inactive" id="star-2" onMouseOver="rating(162166032, 2);" onclick="rate(162166032, 2);"></i> <i class="fas fa-star inactive" id="star-3" onMouseOver="rating(162166032, 3);" onclick="rate(162166032, 3);"></i> <i class="fas fa-star inactive" id="star-4" onMouseOver="rating(162166032, 4);" onclick="rate(162166032, 4);"></i> <i class="fas fa-star inactive" id="star-5" onMouseOver="rating(162166032, 5);" onclick="rate(162166032, 5);"></i> </div> <div class="description text-small"><span id="rating-val">0</span> / 5 - <span id="rating-count">0</span> ratings</div> </div> </div> <div class="mb-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3452512275" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> </div> <div class="col-12 col-lg-4"> <div id="ph-above-related"></div> <div class="card card-custom issue-box"> <div class="card-body pt-3 pb-5"> <h2 class="mb-4">Related issues</h2> <div> <strong> <a href="/magento2/319939019/can-t-change-the-applied-theme-in-2-2-4">Can't change the applied theme in 2.2.4</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars3.githubusercontent.com/u/4441564?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="Krapulat picture"> <strong class="pr-1" dir="ltr">Krapulat</strong>  路  <span class="px-1" dir="ltr">119</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/magento2/313773310/product-page-product-images-slow-to-load">Product Page Product Images Slow to Load</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars1.githubusercontent.com/u/38303191?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="chattertech picture"> <strong class="pr-1" dir="ltr">chattertech</strong>  路  <span class="px-1" dir="ltr">89</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/magento2/94498428/url-key-for-specified-store-already-exists-during-product">'URL key for specified store already exists.' during product imports</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars1.githubusercontent.com/u/6834045?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="naspar picture"> <strong class="pr-1" dir="ltr">naspar</strong>  路  <span class="px-1" dir="ltr">89</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/magento2/163548930/magento-2-1-0-catalog-nav-bar-is-missing-in-2-1-0">[Magento 2.1.0] Catalog nav bar is missing in 2.1.0</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars1.githubusercontent.com/u/19523985?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="Ctucker9233 picture"> <strong class="pr-1" dir="ltr">Ctucker9233</strong>  路  <span class="px-1" dir="ltr">90</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/magento2/389827192/magento-2-3-images-cache-generation-generates-wrong-hash-for">Magento 2.3 images cache generation generates wrong hash for some images with a custom theme that has the keep_frame var set to 0</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars1.githubusercontent.com/u/218081?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="carolineboivin picture"> <strong class="pr-1" dir="ltr">carolineboivin</strong>  路  <span class="px-1" dir="ltr">135</span><span>Comments</span> </div> </div> </div> <div class="sticky-top pt-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3919948963" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <div id="ph-below-related-2" class="mt-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3919948963" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <div class="col-12 col-lg-4"> </div> </div> <div class="skyscraper-container"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="7879185320" data-ad-format="vertical" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="mt-5 spacer"></div> <footer class="mt-5 pb-2 py-4 text-center mt-auto"> <div class="container"> <a class="navbar-brand logo mr-5" href="/"> <img src="/assets/img/logo.svg" width="40" height="40" alt="bleepingcoder logo"> bleeping<strong>coder</strong> </a> <div class="mt-4"> bleepingcoder.com uses publicly licensed GitHub information to provide developers around the world with solutions to their problems. We are not affiliated with GitHub, Inc. or with any developers who use GitHub for their projects. We do not host any of the videos or images on our servers. All rights belong to their respective owners. </div> <div> Source for this page: <a href="https://www.github.com/magento/magento2/issues/5231" rel="nofollow noreferrer" target="_blank">Source</a> </div> </div> <hr class="mb-5 mt-5"> <div class="container"> <div class="row"> <div class="col-sm-4 col-lg mb-sm-0 mb-5"> <strong>Popular programming languages</strong> <ul class="list-unstyled mb-0 mt-2"> <li class="mb-2"> <a href="/python" dir="ltr">Python</a> </li> <li class="mb-2"> <a href="/javascript" dir="ltr">JavaScript</a> </li> <li class="mb-2"> <a href="/typescript" dir="ltr">TypeScript</a> </li> <li class="mb-2"> <a href="/cpp" dir="ltr">C++</a> </li> <li class="mb-2"> <a href="/csharp" dir="ltr">C#</a> </li> </ul> </div> <div class="col-sm-4 col-lg mb-sm-0 mb-5"> <strong>Popular GitHub projects</strong> <ul class="list-unstyled mb-0 mt-2"> <li class="mb-2"> <a href="/microsoft/vscode" dir="ltr">vscode</a> </li> <li class="mb-2"> <a href="/numpy/numpy" dir="ltr">numpy</a> </li> <li class="mb-2"> <a href="/ant-design/ant-design" dir="ltr">ant-design</a> </li> <li class="mb-2"> <a href="/mui-org/material-ui" dir="ltr">material-ui</a> </li> <li class="mb-2"> <a href="/vercel/next-js" dir="ltr">next.js</a> </li> </ul> </div> <div class="col-sm-4 col-lg mb-0"> <strong>More GitHub projects</strong> <ul class="list-unstyled mb-0 mt-2"> <li class="mb-2"> <a href="/rust-lang/rust" dir="ltr">rust</a> </li> <li class="mb-2"> <a href="/moment/moment" dir="ltr">moment</a> </li> <li class="mb-2"> <a href="/yarnpkg/yarn" dir="ltr">yarn</a> </li> <li class="mb-2"> <a href="/mozilla/pdf-js" dir="ltr">pdf.js</a> </li> <li class="mb-2"> <a href="/JuliaLang/julia" dir="ltr">julia</a> </li> </ul> </div> </div> </div> <hr class="mb-5 mt-5"> <div class="container text-muted"> 漏 2026 bleepingcoder.com - <a href="/bleeps" rel="nofollow">Contact</a><br /> By using our site, you acknowledge that you have read and understand our <a href="/cookies" rel="nofollow">Cookie Policy</a> and <a href="/privacy" rel="nofollow">Privacy Policy</a>. </div> </footer> <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script> <script async src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> <!--<script defer type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5fb2db66acbd74b2"></script>--> <script type="text/javascript" src="/assets/js/main.js"></script> <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script></body> </html>