I set up a blog to be date-based, like a classic conventional blog. I read how to make breadcrumbs based on category--
<a href="http://www.xxxx.com">xxxx Company</a> »
<MTEntryCategories>
<a href="<$mt:BlogURL$>"><$mt:BlogName$></a> »
<MTParentCategories glue = " » "><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTParentCategories>
</MTEntryCategories> »
<$mt:EntryTitle$>
This works well, especially since I only had two levels of categories. What I also wanted was a second breadcrumb based on the date. I was disappointed to learn Movable Type considers a folder not to be where the permalink is, but the category. My site structure was:
http://www.xxxx.com/Journal/2015/03/basename/index.html
So it didn't take long to figure out I could make a date-based breadcrumb using:
<a href="http://www.xxxx.com">xxxx Company</a> »
<a href="<$mt:BlogURL$>"><$mt:BlogName$></a> »
<a href="<mt:ArchiveLink trim_to="33">"><mt:EntryDate format="%Y"></a> »
<a href="<$mt:EntryLink type="Monthly"$>"><$mt:EntryDate format="%m"$></a> »
<$mt:EntryTitle$>
Where 33 counted from left to the right to yield the desired abbreviated URL. But see, what if I changed the site to be secure and use https://? Then the counting 33 from the left would break things since there was one more character. It look a lot of messing with regex-replace, but I finally got the two URLs I needed. So given the permalink:
http://www.domain.com/Journal/2015/03/14th-Saturday/
you can use
<mt:ArchiveLink regex_replace="/([^/]+)\/([^/]+)\/?$/","">
to get
http://www.domain.com/Journal/2015/
and
<mt:ArchiveLink regex_replace="/([^/]+)\/?$/","">
to get
http://www.domain.com/Journal/2015/03/
Working back from the right-side end seems like a better way to do things, and I feel pretty confident with the code. I used the online regex evaluator: http://regexr.com/ but it took two hours to learn you hover over the gray trailing slash to add a "g" or a "m" or an "i" to the expression. It does not matter in this case, but nice to know. Don't make my mistake, spending 5 hours figuring out how to match to http://www.domain.com/Journal/2015/03/ using ^(?:[^/]*\/){6}([^/]*?) You want to match to what you want to throw away, the end part you strip off, since that is what you can replace with null "". There are examples of finding an inverse to an expression but it looks really ugly. I hope this helps you deal with regex and date-based breadcrumbs.
Thanks Paul!
You may like to send to me what you wrote above in a formatted writing so that I could update the entry on your behalf.
Sadly, the text is altogether and it looks like some elements have been stripped.
Kind Regards,
Mihai
Looks like you patched up the code with what I sent. Thanks Mihai, you are a true Moveable type godsend.
You're very welcome, Paul!
Stop by anytime you need something!
Thanx for sharing, Mihai & Paul!
You're welcome!