Umbraco Alternative Links doesn't work - umbraco

Hello I created some page in Umbraco 4.7 CMS,
configure some alternative links to page(section) it looks like.
If I look at
Link to document
/folder/folder2/page1.aspx - workig
Alternative Links
http://site.com/folder/folder2/page1.aspx - workig
http://site.com/en/folder/folder2/page1.aspx - not working
http://site.com/old-folder/folder2/page1.aspx - not working
but in browser just /folder/folder2/page1.aspx show a valid page other links redirect users to 404 page that configured in umbraco config file.

Have you considered using the UrlRewriting module to get this working. You could add a new rule similar to the following:
<add name="page1rewrite"
virtualUrl="^~/en/folder/folder2/page1.aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/folder/folder2/page2.aspx"
ignoreCase="true" />
This could be further improved depending on your exact requirements but you could it you wanted rewrite all urls ~/en/folder/folder2/ to the new location.

An alternative option would be to use the umbracoUrlAlias document type property.

Related

How do I select an element based off the value of the parent in an Umbraco.config file?

Please bear with me because I am very new to Umbraco.
I have a test Umbraco config file that looks like the following:
<Product nodeName="For-test">
<customId>222/</customId>
</Product>
<Product nodeName="For-none">
<customId>333/</customId>
</Product>
In my test.master page, I would only like to match the child element who's parent has the value of "For-test". This should give me the value of "222". I am using the following code to display the element values but I get the following error "Error loading MacroEngine script (file: )" I believe that my syntax is wrong.
<umbraco:Macro runat="server" language="cshtml">
#Model.nodeName="For-test".customId;
</umbraco:Macro>
Which Umbraco version are you using? Version 7 is best when using MVC, so you wouldn't typically have a master page at all.
Also, you shouldn't have to be fiddling with umbraco.config at all.
I would suggest you start by installing the starter kit (maybe in a fresh install?), then you can check out how "it" does things. Also, have a good look in the documentation (https://our.umbraco.org/documentation/) and maybe even check out some of the video tutorials (something like these http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/).
As for your specific question:
No need to use the <umbraco:Macro /> tag - but since you are in a Web Forms type website (and not MVC), you can't use # to indicate code sections. You'll have to try with <%= %>.
The Umbraco Model is tied to whatever page you are viewing. You can query for content by Id or "nodeTypeAlias" (which in your case would be "Product", and you'd get all Products at once), but not easily by name since it isn't unique.
But I think you can get a much better grasp of how things are done in Umbraco by looking at the links provided above.
For a detailed error go to App_Data/Logs/ and open the newest .txt file.

How to have unique URLs for a single dynamic page?

I think my question may be worded incorrectly but heres what I want to do (for SEO purposes).
I have a page that gives a logo and description of a brand e.g. Volvo. I want to use this same page as a template for all manufacturers but just change a few words around to customize it for each manufacturer accordingly. So in the URL I pass it a variable of the manufacturer e.g. "www.example.com/cars.cfm?manufacturer=BMW" and it will show a page that gives information about BMW.
The problem is that for each manufacturer the information is still showing up as the same page "cars.cfm" in the address bar but really I want it to go to a URL like "www.example.com/manufacturers/volvo.cfm" so it appears as a unique page just for that brand. But at the same time I don't want to have to create a seperate CFM (or php/asp) page for each manufacturer.
Is there a clever way to do this at all? I imagine its something to do with URL rewriting but not sure. I am using IIS 7.5.
Creating numerous sub-folders for different car manufacturers is going to be very tedious. My site would also include other types of manufacturers for different products not just cars. I guess URL rewriting would be best but my idea was to have a different 'page' for each manufacturer so the SEO would be improved.
Basically....
www.example.com/manufacturers/audi.cfm
www.example.com/manufacturers/bmw.cfm
www.example.com/manufactueres/volkswagen.cfm
But really I want the data on each of those pages to come from a database which contains unique data for each manufacturer such the logo image and history description.
Here is an example of what I mean:
http://www.fivestarautocentre.co.uk <-- go to bottom of that page and you can see links to various manufacturers
Building on what everyone else said, start by creating your www.example.com/cars.cfm?manufacturer=BMW page and get that working.
Assuming you're on IIS you would then create a web.config file (if it isn't already there) in your root folder.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Cars-Rewrite">
<match url="manufacturer/(\w+)" />
<action type="Rewrite" url="/cars.cfm?manufacturer={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
My regex could be off, but maybe someone else could chime in with the correct regex.
You can certainly handle this with URL rewriting as others have suggested but I think I would take a different approach. Particularly for SEO purposes. The best solution for SEO will be an actual URL for each brand. With that in mind create your site accordingly. Don't use a generic www.example.com/cars.cfm page, use www.example.com/bmw, www.example.com/volvo, etc. You can still have a ColdFusion page under each of those folders that does nothing more than include your generic ColdFusion template from another location (or call a cfc). Since each folder will have it's own unique stub file you can pass the appropriate vehicle manufacturer when the generic ColdFusion template is called. For example, under the www.example.com/bmw page:
<cfset manufacturer = "bmw" />
<cfinclude template="/mytemplates/genericpage.cfm" />
Then your genericpage.cfm uses the assigned variable to display the appropriate text and graphics. You could even get around having to set a particular variable under each folder by parsing the URL and grabbing the manufacturer from it when the template is included and executed. I believe the cgi.script_name variable will contain the path needed to do this.

Url Rewriting in Umbraco 5 Jupiter

i want to do simple URL re-writing in Umbraco 5 like we used to do in previous versions i-e changing the UrlRewriting.config file, or we used to do it in Asp .Net
<rewriter>
<rewrite url="~/en/faq.aspx" to="~/faq.aspx" />
</rewrite>
I know we can create new area in the application and then add new routes in areaRegisteration.cs. but then the problem of mapping these controllers to the default Views arises, as the views are in: Views > Umbraco Directory of the application.
For example,
I create a new Area Named "En" and add Route in EngAreaRegisteration.cs, i-e
context.MapRoute("en_property","en/{city}/{controller}/{action}",new { } );
then how i can map the Actions to any Umbraco Page, i dont think the Redirect is a solution as redirect will change the Url,
my URL will be like this, en/paris/property/book
i am using Umbraco 5.0.1 Web deploy.
Thanks in Advance
Sher

Sitecore not resolving rich text editor URLS in page renders

We're having issues inserting links into rich text in Sitecore 6.1.0. When a link to a sitecore item is inserted, it is outputted as:
http://domain/~/link.aspx?_id=8A035DC067A64E2CBBE2662F6DB53BC5&_z=z
Rather than the actual resolved url:
http://domain/path/to/page.aspx
This article confirms that this should be resolved in the render pipeline:
in Sitecore 6 it inserts a specially
formatted link that contains the Guid
of the item you want to link to, then
when the item is rendered the special
link is replaced with the actual link
to the item
The pipeline has the method ShortenLinks added in web.config
<convertToRuntimeHtml>
<processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.PrepareHtml, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.ShortenLinks, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.SetImageSizes, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.ConvertWebControls, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.FixBullets, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.FinalizeHtml, Sitecore.Kernel"/>
</convertToRuntimeHtml>
So I really can't see why links are still rendering in ID format rather than as full SEO-tastic urls. Anyone got any clues?
Thanks, Adam
This will be the default behaviour if you are using sc:fld to render field values. This is legacy behaviour left from Sitecore 5 which did not replace the guids in item links.
If you want to use Sitecore 6's new functionality, you must use sc:field instead
If you are dealing with a large amount of code changes to implement FieldRenderer, might be worth to consider using Sitecore.Links.LinkManager.ExpandDynamicLinks(string text, UrlOptions options). It parses links and references to media items that Rich Text field might contain.
I also ran into something similar.. My client was using a sitecore placeholder , that also doesn't render the links properly. As stated by the answers I ended using a field render:
<sc:FieldRenderer runat="server" ID="frBody" FieldName="Body"/>

Localization in ASP.NET MVC

Visual Studio 2008
I want to bring some localisation into my ASP.NET MVC site.
Someone suggested creating a resource file "Strings.resx" as a publically strongly typed resource, which works nicely and allows me to write
<title><%= Strings.MyView_Title %></title>
I then proceeded to add a file "Strings.da.resx". This file is created right next to the first one, and defaults to "Access Modifier : No Compilation", whereas the first (the one without language modifier) defaulted to "Interal".
I can see in the bin directory that a directory has been created ("da") with a resource.dll, however, I cannot see any of the translated texts on my site.
I have checked with the browser that the only preferred langauge is Danish (da-DK), but I only see the english texts.
Questions:
1) Do I need to enable something in web.config ?
2) Am i creating the right files, with the correct types (i.e. should #2 be "No compilation") ?
In your views, do you have a page directive?
If so, do you have UICulture="Auto" and Culture="Auto"?
For example...
<%# Page Language="C#" Inherits="..."
culture="auto" uiculture="auto" %>
This will ensure that the Accept-Language header, passed by the browser in the request, gets used to set the Thread cultures. It's the UICulture that influences which resource file to pick.
For more on ASP.NET i18n this book is very good...
http://www.amazon.co.uk/NET-Internationalization-Developers-Guide-Building/dp/0321341384/ref=sr_1_1?ie=UTF8&s=books&qid=1241010151&sr=8-1
It doesn't cover MVC, but covers ASP.NET and, as such, many things continue to be relevant.
First you have to create action filter that will switch culture of request thread.
OR
Set your globalization element to UICulture="Auto" and Culture="Auto"
Check this screencast, it is in Russian but code samples are understandable.

Resources