Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find content by route #7

Open
ben-umble opened this issue Aug 28, 2023 · 0 comments
Open

Unable to find content by route #7

ben-umble opened this issue Aug 28, 2023 · 0 comments

Comments

@ben-umble
Copy link

Hey,

Excellent plugin but I'm running into an issue with a headless website build where I retrieve page nodes using their slug.

I've created an "Organiser" doc type and configured for Skipper to hide the URL segment, like so:

"Skipper": {
    "HideSkipperWork": true,
    "Aliases": [
        "organiser"
    ]
}

This has worked, if I visit the page, the "organiser" part of the URL isn't there.

I have a repository which I use to get node by slug, which looks like this:

using Example.Core.Repositories.Interfaces;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Web;

namespace Example.Core.Services;

public class ContentRepository : IContentRepository
{
    private readonly IUmbracoContext? _umbracoContext;

    public ContentRepository(IUmbracoContextAccessor umbracoContextAccessor)
    {
        umbracoContextAccessor.TryGetUmbracoContext(out _umbracoContext);
    }

    public IPublishedContent? GetByRoute(string route)
    {
        if (_umbracoContext != null && _umbracoContext.Content != null)
        {
            return _umbracoContext.Content.GetByRoute(route);
        }

        return null;
    }
}

Unfortunately this doesn't work, the node doesn't appear to be available on it's "original" URL, nor the updated URL after Skipper had done it's work.

Bit of a killer for me if this doesn't work as I don't think I have another way to get content. Any thoughts, ideas, or plugin improvements would be hugely welcomed.

Thanks,

Ben

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant