Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
Starting to work on converting our existing design from AC7 to AC9. In AC7 we did extensive modification of core files. We are trying to avoid that in AC9. However, we hit another roadblock.. We're trying to add Google's Open Sans webfont to our theme. We tried copying the /Views/Shared/_Base.layout.cshtml into our Theme and adding the reference to the HTML head. However, none of the pages picked up the custom layout even though we created ~/Themes/Custom/Views/_ViewStart.cshtml and pointed it at ~/Themes/Custom/Views/Shared/_Base.layout.cshtml. I think it is because almost all of the page-level view files are hard-coded to use ~/Views/Shared/_Base.layout.cshtml. I'm not sure why they don't rely on _ViewStart.cshtml? This is an example ofwhat prevents us from using a custom base layout... Code:@model int
@{
// SET BASE LAYOUT. SYSTEM REQUIRED
Layout = "~/Views/Shared/_Base.layout.cshtml";
// RENDER PAGE TEMPLATE FOR THIS CATEGORY
Html.RenderAction("PageTemplate", "Product", new { Id = Model });
}
I also tried adding <Include Path="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" /> to the Theme.config file, but it doesn't end up getting included either. So what is the preferred way to include external style/font resources?
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
So I found a work-around. Performed a search for _Base.layout.cshtml and found that there were only 3 files referencing it... - ~/Views/Category/Index.cshtml
- ~/Views/Product/Index.cshtml
- ~/Views/Webpage/Index.cshtml
I simply copied those views into our custom theme and updated to point to ~/Themes/Custom/Views/Shared/_Base.layout.cshtml. I was able to add the Google web fonts to that file and now they are properly loaded for the site. With plugins and the ability to override views, we should be able to do quite a bit of customization without touching core files :)
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close