Trouble with pdoCrumbs in a single context- href is not set in the links

I have a site on MODXCloud using 3.1.x. All extras are up to date. The site has several contexts (all are folders not sub-domains using smartRouting).

My issue is with pdoCrumbs leaving the URL blank in the href for the links in the breadcrumb. This only occurs in one of the contexts. All other contexts the pdoCrumbs populates the href just fine. All the contexts use the exact same pdoCrumbs call.

I am down to one remaining possible problem, the key for the context. The Context uses the key “content”. Is that possibly causing the issue? If so how do I rename the context (if I can)?

Thanks
Roy

You can change the context key in the modx_context table, but I’m not sure what the side effects might be.

I’d suggest first comparing the context settings for that context with those of the ones that work.

Also, check any templates for that context to make sure that the MODX tag in the base href tag is called uncached and that the tag looks like this:

(I tried to post a correct base href tag here, but was unable to save the reply. See this post for an example.

and that there is a correct site_url context setting for that context.

I wouldn’t do that!

The “key” column is the primary key of the table and this value is used in multiple other database tables to reference that context (resources, context-settings, ACLs, etc.)
If you don’t change the value everywhere it occurs, you will most likely break your site.

I checked all those things after reading your suggestions. Still no success.

Thanks for the ideas and suggestions!

Halftrainedharry, that is exactly what I thought. So I created new test context, moved the content and the problem remains.

Since all the parents are weblinks (not documents) I wonder if that is the problem?

I have it working now, but I had to use duct tape to fix the issue.

The Parent of the page(s) its the incorrect breadcrumbs is a weblink. When I use either 218 or [[~218]] for its weblink (content) value the output from pdoCrumbs leaves the href blank.

When I type in a full address likehttps://libdev.okstate.edu/home/about/locations-and-hours, everything works fine.

I am down to thinking the issue is with pdoCrumbs and the name of the context creating an error.

I will never name a context something that is used else where in the MODX fields, etc.

I am not satisfied with my solution, but I need to move on to other parts of the site development.

Thanks so much BobRay and Halftrainedharry, you all are truly great assets for the MODX community.

Roy

I’m not sure about these, because I’m relying on a dim memory, but they might be worth trying:

[[~218 &context=`contextName`]]

[[~218 &scheme=`full`]]

[[~218 &context=`contextName` &scheme=`full`]]

You could also replace that tag with a snippet that returns the correct link based on the parent field.

It’s unlikely that the problem is the fault of pdoTools, imo. It’s more likely a tag-processing failure for WebLinks in the MODX parser.

I agree that changing the name of the context in the DB is probably a bad idea. It might not be catastrophic, since MODX usually uses $modx->context->get('key') when it needs that key for reference, and reverting the context name would likely fix it if it caused trouble, but I could definitely be wrong (as I often am).

Thanks that did the trick. I feel better knowing that the link will not need to edited in the future, as pages might move around on the site after UX testing.

Roy

1 Like

Did you try the first one? I have a dim memory of using it at one time.

BTW, on second thought, I was full or crap about the consequences of changing the context name (doh). The context_key field of the resources would not match the actual context key which would definitely be bad.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.