8 votes

This package is marked as retired

This package evolved into the "Virtual Nodes" package which in turn has been replaced with the Discipline package for Umbraco v10/v13.

"Omit Segments" Url Provider

NOTE: For Umbraco v10/v13, use the Discipline package: 

https://marketplace.umbraco.com/package/dotsee.discipline

which provides the functionality of the AutoNode, NodeRestrict, VirtualNodes, and VariantsHider packages together. The VirtualNodes package was the evolution of the "Omit Segments" url provider.

 

(a.k.a. URL Sniper)

Makes Umbraco omit URL segments from a node's URL, based on rules specified in web.config. The URLs generated are native Umbraco URLs, i.e. no rewriting, urlAlias or redirects.

Works with document types, e.g. omits the URL segment for doctype A if found in the path which has doctype B as parent.

Simply put, sometimes you want to omit parts of URLs created by Umbraco (which are based on a node's path).

For example, you'd like the URL:

/company/pageelements/portfolio/portfolioitems/anawesomeproject

to become:

/company/portolio/anawesomeproject

 

Usage

You can make Umbraco omit URL parts from the default url it constructs from a page by excluding it from the path. All you have to do is add entries (as many as you like) in the appSettings section of your web.config file like this:

<add key="omiturlsegments:ParentDocTypeToLookFor" value ="DocTypeToOmitFromUrl,AnotherDocTypeToOmitFromUrl"/>

Where:

ParentDocTypeToLookFor is the parent document type alias that will trigger the plugin to alter the node's URL and

DocTypeToOmitFromUrl (as well as any additional doctypes, comma-separated) is(are) the doctype(s) that will be omitted from the URL path. Those docs with the specified doctypes must be children of the document with "ParentDocTypeToLookFor".

 

Example

Let's suppose that you have a document of type "CarPage" which is used to display car data. You add a child of type "Parts" which is used to group various car parts detailed descriptions, and under it you add multiple documents of type "PartPage".

So, for example, you may have a structure like Peugeot 208/Parts/Engine, where "Peugeot 208" is the CarPage doctype, "Parts" is the Parts doctype and "Engine" belongs to the "PartPage" doctype.

But you don't want the url to say "Parts" or whatever the name of this interim node is. It's just a grouping node and you need this URL segment to go away, so that your Url can be something like:

"/Peugeot-208/Engine"

instead of:

"/Peugeot-208/Parts/Engine".

In order to achieve that, you will simply have to create an entry in the appSettings section of your web.config, like the following:

<add key="omiturlsegments:CarPage" value ="Parts"/>

which will tell the plugin to produce Urls for CarPage doctypes that will IGNORE any segment that comes from "Parts" doctypes under it.

 

Beware!

Make sure that the URLs generated after applying your rules are still unique! Use this plugin only to omit "grouping" nodes or nodes that will not alter the uniqueness of the URL.

 

 

Version History

1.0

Initial Release

1.0.1

Bugfix: Process normally when calling .UrlWithDomain() extension by removing the host part, processing paths and appending again at the end

Screenshots

Package owner

Sotiris Filippidis

Sotiris Filippidis

Sotiris has 1501 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Sotiris Filippidis
  • Created: 11/05/2016
  • Current version 1.0.1
  • .NET version 4.5
  • License MIT
  • Downloads on Our: 713

External resources