Grouping umbraco pages in folders without affecting URL - umbraco

One of our Umbraco sites is getting a bit messy and I was wondering if there was a way of grouping pages in folders without affecting the URL. So for example if under the homepage I have some top level sections, some footer links and various other system pages. I'd like to group the footer pages in a footer folder, the system pages in a system folder but I don't want all the URLs to become /footer/page1, system/contact etc.
Is there a nice way of doing this, maybe something with umbracoUrlName?

There are two answers, first you could turn on the 'hide root folder' option in web.config - then you can have as many folders in the root as you like - without them forming part of the url.
umbracoHideTopLevelNodeFromPath Causes the top level content items to
be excluded from any url paths. For example, this is pre-set to True,
so:
[Content]Home = /home.aspx or /home/
[Content]Home\Projects = /projects.aspx or /projects/
[Content]Footer\Page1 = /page1.aspx or /page1/
[Content]Home\Projects\About = /projects/about.aspx or /projects/about/
http://our.umbraco.org/wiki/reference/webconfig
Secondly there are four 'hidden' redirect fields on every umbraco node (which you can add into the document type) which can change the url routing:
umbracoRedirect (content picker) - Umbraco will redirect to the picked page
umbracoInternalRedirectId (content picker) - Umbraco will load the picked page without changing the url
umbracoUrlName (textstring) - Umbraco will override the page’s default url
umbracoUrlAlias (textstring) - You can have several urls for the same page (not sure when this is useful)
So I guess in your scenario umbracoUrlName will pick out a page in your combined folder but with a url that you choose.
So you have
homepage
|- footer
|-page1 (umbracoUrl = "/footer-page1/")
and /footer-page1/ would render your page stored in the footer folder.
You could also hack things about and make umbracoRedirect & umbracoInternalRedirectId work but I'm not sure that it would help.

Related

How to categorize links without changing the URL

I'm re-building a site that's had lots of SEO work done to it. Currently built in ASP.NET web forms, I'm re-building in ASP.NET MVC.
All links have been "re-written" for SEO purposes. Examples:
- If you search for "foo", the search result URL will be "foo-stuff-for-sale", if you search for "bar", the URL would be "bar-stuff-for-sale" - you get it.
- The search results are "categorized" - i.e. categories are "widgets", "clocks", "clothing"...where the search term is contained in some portion of the products under each category
- If you click on a link from a category, the resulting search page would go back to the same search result, but without the category that was clicked on. i.e. - search for "foo", click on a link under "widgets", you'd go back to "foo-stuff-for-sale", but the "widgets category wouldn't show.
With Web Forms, this was being accomplished by a property in the .ascx page that was displaying the links and would be stored on the link itself somehow so that the link handler would be able to grab it and omit stuff from that category.
How do I accomplish the same thing using ASP.NET MVC and razor templates?
I've thought about:
Cookies - set the cookie using jQuery.cookie on click from a "data-category" attribute, read the cookie in the controller and then remove the cookie on display.
jQuery - setting something else on the query string onClick that the controller can read, but then doesn't show in the URL upon display.
UPDATE: Additional context: This was done in the old implementation via a session variable. I'm doing all I can to get rid of session state for this new implementation.
Thoughts? Ideas?

Rendering grails views on different sub URL

I am creating a rest based web application. i want all the rest based pages (HTML pages) should go into webapps folder and should be accessible at from there with the below URL
http://localhost:8080/myapp.
Above URL should render index.html lying in webapps folder. And all the subsequent pages should open from webapps folder only.
For the admin part i want to use grails views(GSP) and they should be accessible at
http://localhost:8080/myapp/admin
Above url should render the index.gsp page lying in grails-app/views/index.gsp.
To list all users on admin site, i want URL to be some thing like this
http://localhost:8080/myapp/admin/user/list and this should point to grails-app/views/user/list.gsp and userController with action list
Is there a way this can be achieved in Grails
Grails exposes your controllers and views using conventions by default. However, if you want to break that convention you can. There is nothing stopping you from re-working how the URL mappings are done in your application. In fact there is an entire section of the documentation dedicated to it.
Let's pretend for a second you wanted all your controllers to be under /admin/ you could easily change your UrlMappings.groovy to look like this:
class UrlMappings {
static mappings = {
"/admin/$controller/$action?/$id?(.$format)?"{
constraints {
// apply constraints here
}
}
}
Once you read through the documentation you should be able to map things however you want. The key is you have to define how you want them mapped.

Why data is different in Next Page Flow Report and PageView report?

This is related to Site-Catalyst reporting.
I was looking into 'Next Page Flow Report' for a particular page. The report says, for a particular time duration, the total path views were 4500. But when I looked into 'pageViews' report of the same page, it says, the pageViews of that page for the same duration was 5,000. Ideally, the pageViews and path views should match, since anyone who landed on that page (which is pageview) must either exit or should navigate to any next page (which comes in next page flow report). Not sure, why this difference is coming then.
Does anyone has any idea about this ? Please help.
Thanks,
Adwait
For example, let's say you have 3 pages, and lets say that individually (looking at pages report), each page had 10 page views:
PageA : 10 page views
PageB : 10 page views
PageC : 10 page views
In your pages report, you should see it just like that. But page views within a pathing report are shown in relation to paths, not standalone page views. So for example, one path could be:
PageA (3 page views) > PageB (4 page views) > (exited site)
This just shows how many people took the same path throughout your site, where they diverged, etc..think of it like a choose-your-own-adventure book, where at each point of the story, the reader can choose which way the story goes, so that overall, there are different permutations of the story. A website works in much the same way. Visitors can start off on virtually any page accessible on your site (though usually the homepage or landing pages are the most common), and from there, they navigate to wherever else on your site.
So, if you were to add up the page views for PageA for all the paths, it should match what's in the base pages report, but if you are looking at page views for an individual path, it's not going to add up, because it's just page views for that page that happened in that one path (well, it's theoretically possible for them to match, e.g. if there's only one path, but that's highly unlikely to actually happen).
Path Views will always report Pure Page Views (yes, I call it Pure).
What does this mean? Well, it simply means that the Path Views for a Page is equal to the Total Page Views less the Reloads of that Page for a specific period.
Therefore, if your Path Views are 4500, and Page Views are 5000, then this means that your page was reloaded 500 times.

Creating custom URLs with TYPO3, RealURL and tt_news

Im still not understanding very well how the configuration of RealURL works. So far Im getting my news with this format:
http://www.mysite.com/games/detail/date/2012/01/01/game-1/
But Id like it to be able to customize the URL as I want, like:
http://www.mysite.com/games/WhateverIwanthere/
I have a page with the LIST view (id=3) and a child page with the SINGLE view (id=13)
This is my realurl_autoconf.php: http://pastebin.com/31s9uZDb
Get rid date params from your tt_news links see tt_news docs and find Settings for Links section
Put LIST view and SINGLE view on the same page and switch the views with TypoScript (there are snippets in the net so I don't writ it here)
Use fixedPostVars of RealURL to avoid redundant 'detail' word
With this scenario you'll be able to display:
http://domain.tld/games/ - LIST view
http://domain.tld/games/one-two-three/ - SINGLE view of One Two Three game

Adding content to static files(pages)

I have several static files(pages), which are basically copies of my website pages source code, with the content changed.
These files support my website, (keeping the same format) in various ways.
For example the menu part is:-
<body>
<div id="menu">
<ul class="level1" id="root">
etc
etc. until
</ul>
</div>
Unfortunately every month or so my menu bar changes and I have to update each static file manually.
As each of my static files have the same menu.
Is it possible to have one menu file which can be updated and have the static files load them automatically.
I plan to have several more static files. So this would be a great help if someone can suggest how to accomplish this.
Oh yes. Use some javascript magic to load the menu bar upon page load and keep it in menu.html.
One solution may be to use a spider (wget --recursive) to download generated pages directly from your application. One command, and you have the full copy of your site. (just add some useful options, like --convert-links, for example).
The other option may be to write an after_filter in your controller, and write the generated content to a file (not always, but for example when you add a parameter ?refresh_copy=1). Maybe just turning on page caching would be suitable? But the problem will be that you will not be able to trigger the controller action so easily.
If you don't want the whole site copied, just add some specific routes or controllers (/mirrorable/...) and run the spider on them, or just access them manually (to trigger saving the content in the files).
I ended up creating one controller without a model.
rails g controller staticpages
I then created a layout file which imported the individual changes to the layout, via a "yield" tied to a "content_for" in the view files(static files(pages) in the "view of staticpages" (for example abbreviations, aboutthissite etc etc).
The rest of the static file loaded with the usual "yield" in the layout. Works a treat. No more updating the menu bar all done automatically.
To get to the correct static file I created a route using:-
match 'static/:static_page_name'=> 'staticpages#show' (or in rails 2.x:-
map.connect 'static/:static_page_name', :controller=> "staticpages", :action=> "show"
"static_page_name" variable accepted anything after "/static/" in the url and passed it to the controller "staticpages" in which I set up a show action containing:-
def show
#static_page_name = params[:static_page_name]
allowed_pages = %w(abbreviations aboutthissite etc, etc,)
if allowed_pages.include?(#static_page_name)
render #static_page_name
else
redirect_to '/' #redirects to homepage if link does not exists
end
end
I then only had to change the links in the website. (e.g.<%= link_to " About This Site ", '/static/aboutthissite' %>)
and viola! its all working.

Resources