Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lee 1123 posts 3059 karma points
    Dec 10, 2009 @ 12:09
    Lee
    0

    URL's

    Hey - Using your package and its great =)

    One question I have is about the URL's?  I am using Alphabet folders, and the URLs are being published as below

    /a/a-page-name.aspx
    /r/repeat-page.aspx
    /z/zoo-information.aspx

    Is there any way to over ride this, or make a URL like so?  As they are all part of one section?

     

    /mycustomname/a-page-name.aspx
    /mycustomname/repeat-page.aspx
    /mycustomname/zoo-information.aspx

     

    Thanks

  • Lee 1123 posts 3059 karma points
    Dec 11, 2009 @ 10:31
    Lee
    0

    Guess not :(

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Dec 11, 2009 @ 10:34
    Tim Geyssens
    0

    Maybe you could use the umbracourlname property, and fill that on creation of the new pages

    http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracourlname

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Dec 11, 2009 @ 10:34
  • Stefan Kip 1606 posts 4098 karma points c-trib
    Dec 11, 2009 @ 11:54
    Stefan Kip
    0

    What I'm doing at the moment:

    I have a 'folder' document inside the content tree called 'partners', but I don't want the url to be /partners/some-partner.
    So I created an instance of ApplicationBase which sets the property umbracoUrlName like /some-partner.
    The code:

    public PartnerBase()
    {
        Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
    }

    void Document_AfterPublish(Document doc, PublishEventArgs e)
    {
        doc.getProperty("umbracoUrlName").Value = string.Format("/{0}", GenerateSlug(doc.Text));
        doc.Publish(doc.User);
    }

    The GenerateSlug method:

    static string GenerateSlug(string phrase)
    {
        phrase = phrase.ToLower();
        phrase = Regex.Replace(phrase, @"[^a-z0-9\s-]", string.Empty); // invalid chars
        phrase = Regex.Replace(phrase, @"\s+", " ").Trim(); // convert multiple spaces into one space
        phrase = phrase.Substring(0, phrase.Length <= 45 ? phrase.Length : 45).Trim(); // cut and trim it
        phrase = Regex.Replace(phrase, @"\s", "-"); // hyphens
        return phrase;
    }
  • Adin 11 posts 31 karma points
    Dec 31, 2010 @ 01:10
    Adin
    0

    I tried but this doesn't work for me maybe i should debug it but that requires me to setup environment on my machine.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies