Dotcms Detail Page not found - dotcms

I have a content type for which I have specified a detail page and URLMapPattern but for the URL pattern the detail page 404 found error occurs.
The detail page also exists.
Detail Page: //demo.dotcms.com/Platform-Technology/Promotions/promotion-details
URL Pattern: /Platform-Technology/Promotions/{urlTitle}
And on the content the following tag has been added:
but in browser for Platform-Technology/Promotions/demo-promotion-1
Page not found 404 error

There are a number of things that could cause this problem, most likely related to the details of how you've implemented either the URL Maps themselves, or how you're attempting to access the URL Mapped content URL.
Make sure that you have a URL Title field in the content type, and that the Velocity variable name of that field is "urlTitle".
If the Velocity variable name doesn't match, you'll get a 404.
Make sure that the content in question has a value of "demo-promotion-1" for it's URL Title field.
If the content item doesn't have this value in the "urlTitle" field, you'll get a 404.
I'm not sure what you're referencing when you say your content has a tag value, but tag fields are not used with URL maps.
When you attempt to access the URL of the URL-mapped content, try doing it using the IP address of the server (e.g. "http://x.x.x.x" or "http://localhost").
It seems that you haven't changed your Host from the default of "demo.dotcms.com", and depending on how you're accessing the URL, you may be accessing the actual dotCMS demo site (http://demo.dotcms.com) instead of your local host (and if you're doing this, you'll always get a 404, since your content doesn't exist on the actual dotCMS demo site).
If none of this helps, I suggest you provide more details (such as your full Content Type field list, your full Content Type properties, and the full properties of the content item, and the full URL you're using including the leading "http://"). And considering posting in the dotCMS community forum, since there are more active dotCMS users there who may be able to help.

Related

django and angular url patterns

Sometimes in my code I pass get parameters with URL's. One particular scenario is if the user is not logged in, but puts a URL for a page that requires login, they will be required to login first.
In that case I may have a URL such as: www.example.com/home/#/main/.
The end of the URL /#/main/ is for angular. However, in django when I do the below to get the next parameter above, I do this:
self.request.GET.get('next', self.redirect_url)
The problem is that in this case, next provides everything but the angular portion, so I get: www.example.com/home/.
Is there anyway to get the remaining portion of the URL as well?
You have to urlencode the url before you add it as a parameter. Then it will turn into %23 and insn't the separator for the anchor anymore, which is handled client side only as KVISH described.
Apparantly you can't. Django doesn't even see the anchor, its all handled on client (browser).
How to identify an anchor in a url in Django?
The way I got around this is I use jQuery to set a hidden input field to the hash location, which can be obtained like so:
window.location.hash
The hash gets submitted with the form and I can take it from there.

Overriding URL paths sent to Google Analytics

In my web application, I have a path as /search.
I also have a cookie named city set as CityA or CityB depending on what the user selected previously. I have set up Google Analytics to monitor the Visitor Flow.
My question is, how can I override the path /search to show up as /cityA/search or /cityB/search in the Analytics Behavior Flow menu, depending on the cookie value?
PS. It is a Rails app and actually changing the URL is not feasible at this point, since I will then have to reconfigure my Routes.rb file and update links everywhere.
Edit:
I have to use ga.js. Moving to Universal Analytics(analytics.js) is beyond my control at the moment.
In your analytics.js snippet you should see the following line:
ga('send', 'pageview');
You can pass an additional argument to the send method that overrides the page path. In your case it would look something like this:
ga('send', 'pageview', {
page: 'cityA/search'
});
You'd have to add some Rails logic in your .erb file to adjust the page value based on the cookie, but that shouldn't be too much trouble.
For reference, here's some information on the send method and the arguments it accepts:
https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference#send

can't access facebook using fandjango

I have fandjango setup on my django app and I have the "Site URL" pointing to the exact spot where the dynamic page is shown.
http://www.example.com/apps/myapp
This gives me the following error message box.
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I'm not sure how to debug this. Looking at similar people's posts, they said they had this problem only if there was a mismatch between the site url, but even if I copy and paste the site url into my browser, I still get the same error. I don't have https setup, if that matters.

When I submit a form in django (or access admin) the address changes in URL bar to an ip address

I have the following set up.
On my dns:
an A name record that points my domain to an IP addres
On my server:
nginx -> gunicorn -> django
But when I submit a form (e.g. log in form) the address in the URL bar changes from my domain name to my IP address. This causes a Cross Domain Error.
This happens on forms and when I access mydomain/admin
when I access pages my domain name in the URL bar remains intact. When I go to mydomain/admin it automatically switches to the IP w/o submitting any other forms. Any other time I have to submit a form for it to change to the IP address.
All my media and everything use mydomain in the path. It is the strangest thing. I only first noticed it when I went to my admin page, but didnt think much of it. But I just added a few forms and now I can't submit the forms because the forms try to submit to the IP address causing the cross domain error.
I should add teh forms are auto generated by django-registration.
Look for your IP in your settings.py file. It could be a setting like MEDIA_URL set to use your IP and not your domain.
This has to mean that your forms are configured to submit to the IP address. Look at the source of your form and look for the form tag:
<form action="http://(ip here?)/form/" method="GET">
Make sure that IP address isn't inserted there. You could use a relative URL. I normally leave it blank since most of my forms are processed by the same view that generated the form to begin with.
I'm assuming that you were developing locally at some point and this did not occur so I'd suggest it's something in your Nginx config. Can you use Firebug/Web Inspector to see if there's any redirects happening from your domain to your IP?
I'd also check to make sure that your Site's URL is correctly set up in the admin. Sometimes this can cause incorrect urls although I don't think the cases you've mentioned apply.

Django: how to redirect to mailto

I have a Django admin action called "Email selected members". Check some members and click the Go button and the user's mail program is opened. The emails of the selected members have been pre-entered.
This works by a Django HttpResponseRedirect(uri) with the uri being "mailto:email1,email2..
where the addresses email1, email2 ... were looked up on the server.
The only problem is that that the browser re-directs to a blank page as well a opening the client mail program.
Is there any way to avoid this?
-- Peter
This question is a little old, but I just went through this and I think I can help anyone looking for an answer in the future.
I ran into this problem because the website I was building had a built-in tracking system that tracked the URLs of outbound links for self-hosted ads. If I don't redirect, there is no way (without changing the way it was implemented) to track the click, since I'm not using an API or anything.
The easy fix was to do what you did, sending back an HttpResponse() whose content is the meta tag
<meta http-equiv="refresh" content="0;url=mailto:youremail#test.com" />
This causes the page to refresh on load, which triggers the mailto: action.
Now we're left with an open window, but we can't close the window using Javascript's window.close() method. I do believe that this solution should work, however. Call that Javascript function after the refresh has been successful.
Unfortunately, I haven't tested this, but these two methods should accomplish a mailto: redirect that does not leave a blank window/tab behind.
Hope this helps!
Don't use HttpResponseRedirect. Just make the mailto: line a link. Email selected members
I don't think it is possible. RFC 2616 says re 302 redirect:
The temporary URI SHOULD be given by
the Location field in the response.
Unless the request method was HEAD,
the entity of the response SHOULD
contain a short hypertext note with a
hyperlink to the new URI(s)
So the blank page that I see is the (very) short hypertext note. The browser gets the redirect instruction, pops up a temporary page with the redirect message, then retrieves the redirected URL. But with a mailto: URL the temporary page obviously remains.