I have created a custom link using default.xml and moved it inside the top.links reference block. This is my code
<referenceBlock name="top.links">
<block class="Magento\Framework\View\Element\Html\Link" name="custom-top-link-blog">
<arguments>
<argument name="label" xsi:type="string" translate="true">Blog</argument>
<argument name="path" xsi:type="string">#</argument>
</arguments>
</block>
</referenceBlock>
I have also made some changes to top.links block.
<move element="register-link" destination="top.links"/>
<move element="top.links" destination="header-wrapper" after="minicart"/>
This is what I have achieved. Plz check the screenshot.
Now I need to move my custom link "Blog" before My Account that is in the first position. Screenshot where I need it.
How I can achieve this. I have tried adding before="-" in this line
<block class="Magento\Framework\View\Element\Html\Link" name="custom-top-link-blog" before="-">
but it did not worked. Plz suggest how I can achieve this.
Update: I have tried a solution according to the suggestion in comment but it did not worked. I found the block name for My Account section. I found it inside the module-customer default.xml file. This was the code.
<referenceBlock name="top.links">
<block class="Magento\Customer\Block\Account\Link" name="my-account-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">My Account</argument>
</arguments>
</block>
<block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">Sign up</argument>
</arguments>
</block>
<block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link"
template="Magento_Customer::account/link/authorization.phtml"/>
</referenceBlock>
Then I used this block name in my custom theme default.xml file to change the position of Blog but it did not worked. This was the code that I added in default.xml file.
<move element="custom-top-link-blog" destination="top.links" before="my-account-link"/>
Plz let me know a solution to achieve this as I am stuck in this.