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

How lose or override "Home" menu item in a blog-only site #384

Open
CrispinF opened this issue Feb 10, 2019 · 10 comments
Open

How lose or override "Home" menu item in a blog-only site #384

CrispinF opened this issue Feb 10, 2019 · 10 comments

Comments

@CrispinF
Copy link
Contributor

  1. how lose it?
    Create site with "blog only with blog as default route"... we still get a "Home" menu item linking to /blog, which is all redundant. Not sure what I can safely change in navigation.xml?

I can set the text of the root navnode to nothing of course, but we still end up with an empty link to /blog in the html.
I've tried adding componentVisibility="sitemap" but it still appears in the top menu.
I've tried remove the controller and action from the navnode, but the link still appears and then the breadcrumb of the PrivacyPolicy page appears on the page.

Is there a nice way to do this? (and should this menu item be absent by default in this mode?).

  1. how override it?
    I'm wanting the "blog only" mode as a child site (I have multiple blogs for different purposes within a site).
    In this scenario the "Home" link could have a purpose, i.e. to take the user back to the parent site (which is "home" from their perspective). I've tried using a CMS page with override URL for this, but even when expressed as an absolute URL this doesn't work.
    If the parent site did not also have Pages, we would be able to do this:

    but in my scenario with pages and blog, this removes the blog from the child site as well, and we need to have the tree builder:
    treeBuilderName="cloudscribe.SimpleContent.Services.PagesNavigationTreeBuilder"
    So I can't really have "blog only with blog as default route" in a child site when the parent site has both pages and blog - is that correct? [I think this is OK as I can repurpose the "home" as an "introduction" and put another link to the parent site into the menu using an override URL, but just wondering whether I'm missing any neat way of using child sites for blog-only].

thanks!

@joeaudette
Copy link
Collaborator

I think if my goal was to have folder child sites that are blog only but keep the root site using simplecontent pages I would do the following things:

  • Create the project with the default settings so it includes pages for the root site.
  • Once the root site is created note the siteid and copy the navigation.xml file as navigation.siteid.xml. Now the root site will use that specific navigation file and all new folder sites will use the navigation.xml file so you can now edit the default navigation.xml file without affecting the root site and you can therefore remove the home node treebuilder. Ultimately you do need the home node to be the root of the navigation xml but it can be tweaked to be the blog node and only show as breadcrumbs since it is the parent node of the rest of the tree.
  • Then you would need to tweak the routing for folder sites to make the blog the default route for the folder sites
  • Keep in mind there are several ways the blog can be added to the menu, so if you add it from the xml you need to make sure it is not added from content settings page as well.

@CrispinF
Copy link
Contributor Author

Thanks - useful @joeaudette I'll try that. This whole topic might be worth a documentation page, as I think a CMS site with multiple blogs is not unusual and it throws up various questions like these.
Could you clarify how to achieve "Then you would need to tweak the routing for folder sites to make the blog the default route for the folder sites"?
And another related question: my file managers in the different sites seemed to be walled off from each other... is there a way for them to use the same area?

@joeaudette
Copy link
Collaborator

joeaudette commented Feb 10, 2019

I just got this working here to make sure about the needed steps.

In addition to what I mentioned above.

For routing you need to comment out the default page route since you don't want pages in the child sites, and update the default folder route as shown below.

routes.MapRoute(
                name: "folderdefault",
                template: "{sitefolder}/{controller}/{action}",
                defaults: new { controller = "Blog", action = "Index" },
                constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                );


            //routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());

after creating the more specific navaigation file for the root site I edited the navigation.xml home node like this:

<NavNode key="Home" 
     namedRoute="folderblogindex"  
      text="Home"
     componentVisibility="breadcrumbs"
     >

...

Note that this did not remove the home menu item from the top nav to solve that I did the following.

Under the root site ie sitefiles/s1 add new folders to make the path sitesfiles/s1/Views/Shared/Components/Navigation

Copy the Bootstrap4ToopNavWithDropdowns.cshtml into that folder so the root site can keep the home link.

Next copy that Components folder with the new file into the main Views/Shared folder, this is the one the child sites will use. Now edit the view and remove the home link.

That is all, now it should work, child blog sites have no home button other than the site title link. Admin menu appears as it should and the home node still works as a breadcrumb for admin pages. It also acts as a breadcrumb for post detail. If you prefer the breadcrumb to say Blog rather than Home, you can change that in navigation.xml

@joeaudette
Copy link
Collaborator

Out of curiosity and to help me get a better idea about a documentation opportunity.

You are using folder tenants right?

Are you using related sites mode, if not why? Is it because you think the users have to be admins in the child sites in order to edit?

If my hunches are correct I can explain how you can make users able to edit a specific blog without making them tenant admins and while using related sites mode.

@CrispinF
Copy link
Contributor Author

Bedtime, but...
I'm using folder tenants. Related sites mode is on and working,
I'm not wanting to restrict editing rights at all - really I want several blogs in one site (each with their own tags, archives, entry point and url segment), but since that's not possible I'm trying to find the closest solution with least pain! Hence not wanting file storage areas to be walled off, etc.

@joeaudette
Copy link
Collaborator

Ok, if I understand you, all your requirements are currently met except you wish the user uploads were also shared across sites ie same file system in file manager is what you want?

@joeaudette
Copy link
Collaborator

And that would be on disk in the master site files?

@joeaudette
Copy link
Collaborator

Further thought that is probably how it should work in related sites mode, if sharing users and roles across sites then most likely would want to share media as well. Particularly with folder tenants, related sites mode isn’t really like separate tenants more like areas within the same site possibly with different section editors but not always.

@CrispinF
Copy link
Contributor Author

CrispinF commented Feb 11, 2019 via email

@joeaudette
Copy link
Collaborator

Ok, this is now supported in the latest nugets. There is a new property on MultiTenantOptions for RelatedSiteAliasId, and if you specify that in appsettings in addition to RelatedSiteId then all tenants will share the same media folder under the master tenant alias id.

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

No branches or pull requests

2 participants