This is my first time round using Umbraco and I have created Document Types / Pages using the wrong naming format and now this has transpired into my page URL's, for instance /about-page/. How would I go about changing them to /about as I have searched the back-end admin panel and there dose't seem to be an option to change their link to document values.
Would anyone be able to provide a simple code based example using umbracoUrlAlias or umbracoUrlName how I could change this preferably in Razor.
Thanks
Editing #run yards Solution by digbyswift help in comment
Correct Solution:
Create Property on in Document Types which applies to all pages you want to change the URL
Call the name anything you want e.g Page URL and Possibly give it a new tab.
Call the alias umbracoUrlName
Type as text sting
Should not be Mandatory (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
Tab as Generic
Click Save on top right on the page
Added screenshot for starter kit on Umbraco v7.2.5
Unless I'm very much misunderstanding your issue, you should just be able to change the name of your page and republish. This doesn't need an additional field, just change the value in the "Properties" tab and republish the page. This will automatically change the URL of the page.
You can also create a property called umbracoUrlName using a TextString property editor. If this has a value then it will generate the URL fragment for the page using this value, rather than the page name. This changes the URL for the page, rather than creating an alias, like umbracoUrlAlias.
Solution:
Create property on in Document Types which applies to all pages you want to change the URL
Call the name anything you want e.g Page URL and Possibly give it a new tab.
Call the alias umbracoUrlAlias
Type as text sting
Make it required (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
Go into all your pages and rename them using the property you just created
Now with your code, say with the navigation where you have used .Url change it to .umbracoUrlAlias and the new URL's will be used.
Note if you don't use .umbracoUrlAlias the links will still be active i.e. they work but they won't be displayed in the address bar as .Url spits out the original ones associated with the page.
You can apply on URL names in web.config:
In section find:
<add key="umbracoUseDirectoryUrls" value="false" />
this will set url names for new created items to name.aspx
If you set this to 'true' then new items will be named like /name/
Additionaly you might want to avoid of Handling some urls by Umbraco pipline, just use this setting - add URLs which must be bypassed:
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
Related
I'm new to alchemy-cms.
I created a fresh install from the guides. I did not add any concept or structure.
Going to localhost:3000 I have to add the first user and after that I have a clean site.
When trying to add a new page, I have to select a type (page-layout?) and type in a name.
The Type combobox remains empty, and therefore the website don't allow me to add a page. What am I doing wrong? I think I'm missing something very obvious here.
I have looked allready in the source code, and running the following:
rails console
Alchemy::PageLayout.all
and this results in:
=> [{"name"=>"index", "unique"=>true, "elements"=>["article"], "autogenerate"=>["article"]}]
So I would guess the combobox should be filled with this item.
The index page layout is marked as unique, so it can only be added once per language. And as the so called language root page (the first most page in your page tree) already has this page layout, no new page can be created using this page layout.
In order to fix your problem you need to add another page layout to your page_layouts.yml file. It is good practice to add an standard page layout that is not unique (default) and can therefore be added multiple times per language.
This view suppose to show a list of hyperlinks, each pointing to an external URL. The goal is for the user to click one of these links and have their browser open a new tab with the selected URL.
Currently I have the following markup:
#Html.ActionLink("SomeSite", "http://subdomain.mydomain.com/SomeSite")
This markup produces:
http://localhost:58980/AccessInstance/http%3a/subdomain.mydomain.com/SomeSite
instead of :
http://subdomain.mydomain.com/SomeSite
What can I change in my markup to make this work as I expect?
You don't need to use #Html.ActionLink for that. Just use a plain A tag:
SomeSite
Html.ActionLink is specifically for generating links to actions defined in MVC controllers, in the same app. Since you're linking to an absolute URL, you don't need any of the functionality that Html.ActionLink provides.
Two ways :
1. update the database column with full link:
eg SQL:
update ProductTable set ProductLink='http://www.example.com/Product/Mobiles' where ID=123
In asp mvc view
View
2. Hardcode the http part and list from model
View
Hope helps someone.
While a ViewBag is overused and not the best choice most of the time this is something that I had done when inheriting someone else's mvc app to do a quick fix for a URL that I needed to redirect to with a specific dynamically changing querystring parameter
<a target="_parent" href="http://localhost:56332/services/#ViewBag.factory">View Service</a>
Using .NET Core 6
This seems to be the most correct answer:
Link
This will generate the following result:
As you can see at the bottom left corner of the window before clicking the link, the URL address was rendered as it is (NOTE: The cursor was recorded out of place for some reason, that's a ShareX problem, ignore it).
Than link will be directly saved as a nvarchar(750) type (probably any character like type will do the work). No changes to the original link were made before saving it or on reading:
You need to take into account your RouteConfiguration.
routes.MapRoute(
name: "Default",
url: "{controller}/{action}"
because you are specifying the action link as the entire link that you want to redirect.
I would recommend that you use the #rossipedia answer because you can make tricky things like putting a span inside the link
Here to display link that are clickable in index page
<td>
#Html.ActionLink(item.FileName, "../Uploads/Catalogue/"+item.FileName)
</td>
How can I create a sidebar in Umbraco that is common to all pages that uses a specific template, but is still editable for a editor?
If I simply create the sidebar in the template I would have to edit it myself every time they want something changes.
On the other hand if I create a sidebar field in the document type and map it to the sidebar in the template the editors have to recreate the same sidebar content for every page.
It's possible to use the recursive property on your template.
Basically what you do is on your homepage, or which ever root node for the section you want to use, you create the property which will contain your sidebar text. I would suggest the homepage.
Then you add a page field on the template with the attribute recursive=true
You can add the page field by adding the property a follows
This would result in a field that looks something like the following
<umbraco:Item field="category" recursive="true" runat="server" />
In my example, the property on the homepage which is being used is category.
Then any page which exists below the homepage, if it doesn't have a property with the same alias, then the value from the homepage will be taken.
A very useful feature :)
Say I create an HTML file with two .page on it. In the first .page, I'd like to have a link to the second .page.
Is there a way to navigate between pages without having to write my own JS? This seems to suggest I do have to write JS: http://view.jquerymobile.com/1.3.2/dist/demos/widgets/navigation/.
However, I'd would rather set an id attribute for one of the pages, then maybe define some data attribute in the link to tell jQuery mobile where to go. Possible?
I'd also like to specify what kind of transition effect to use.
You can use standard anchor links, just give an id to your page and set the transition via the data attribute
Link to Page 2
Even If the url is same can i go to different action using Html.RouteLink and Action Link.Like when i click on news link i will go to news details.The url of this page is http://localhost:1390/en-US/latestnews/125.Now if i select the ddl of language in the site header in this pagei need to
go to the home page of the site.The ddl (on change) will take the same url but this time it needs to go to action in the sane controller.
The URL will direct to the controller/action on the first routing entry that it matches regardless of how you generate it. I'm not sure exactly what you are trying to accomplish, but I suspect that what you need to do is use javascript to direct to a different url, perhaps generated with Html.RouteLink instead of Html.ActionLink based on the value of the drop down list when it's selected. If I'm misunderstanding what you are trying to do, please clarify.