relocate favicon rendering
This commit is contained in:
parent
dbe7324c7f
commit
3b214a0105
|
@ -2,7 +2,7 @@
|
|||
@using Oqtane.Shared
|
||||
@inject SiteState SiteState
|
||||
|
||||
<title>@title</title>
|
||||
@((MarkupString)title)
|
||||
@((MarkupString)content)
|
||||
|
||||
@code {
|
||||
|
@ -21,14 +21,14 @@
|
|||
case "PageTitle":
|
||||
if (title != SiteState.Properties.PageTitle)
|
||||
{
|
||||
title = SiteState.Properties.PageTitle;
|
||||
title = "\n<title>" + SiteState.Properties.PageTitle + "</title>";
|
||||
StateHasChanged();
|
||||
}
|
||||
break;
|
||||
case "HeadContent":
|
||||
if (content != SiteState.Properties.HeadContent)
|
||||
{
|
||||
content = SiteState.Properties.HeadContent;
|
||||
content = SiteState.Properties.HeadContent + "\n";
|
||||
StateHasChanged();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -29,8 +29,16 @@
|
|||
SiteState.Properties.PageTitle = PageState.Site.Name + " - " + PageState.Page.Name;
|
||||
}
|
||||
|
||||
// set page meta
|
||||
SiteState.Properties.HeadContent = PageState.Page.Meta ?? "";
|
||||
// set page head content
|
||||
var content = "";
|
||||
var favicon = "favicon.ico";
|
||||
if (PageState.Site.FaviconFileId != null)
|
||||
{
|
||||
favicon = Utilities.FileUrl(PageState.Alias, PageState.Site.FaviconFileId.Value);
|
||||
}
|
||||
content += $"<link id=\"app-favicon\" rel=\"shortcut icon\" type=\"image/x-icon\" href=\"{favicon}\" />\n";
|
||||
content += PageState.Page.Meta ?? "";
|
||||
SiteState.Properties.HeadContent = content;
|
||||
|
||||
DynamicComponent = builder =>
|
||||
{
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<component type="typeof(Oqtane.Head)" render-mode="@((RenderMode)Enum.Parse(typeof(RenderMode), Model.RenderMode, true))" />
|
||||
<base href="~/" />
|
||||
<link id="app-favicon" rel="shortcut icon" type="image/x-icon" href="@Model.FavIcon" />
|
||||
@if (!string.IsNullOrEmpty(Model.PWAScript))
|
||||
{
|
||||
<link id="app-manifest" rel="manifest" />
|
||||
|
@ -20,6 +18,7 @@
|
|||
@Html.Raw(Model.HeadResources)
|
||||
<link id="app-stylesheet-page" rel="stylesheet" href="css/empty.css" disabled />
|
||||
<link id="app-stylesheet-module" rel="stylesheet" href="css/empty.css" disabled />
|
||||
<component type="typeof(Oqtane.Head)" render-mode="@((RenderMode)Enum.Parse(typeof(RenderMode), Model.RenderMode, true))" />
|
||||
</head>
|
||||
<body>
|
||||
@if (string.IsNullOrEmpty(Model.Message))
|
||||
|
|
|
@ -65,7 +65,6 @@ namespace Oqtane.Pages
|
|||
public string RemoteIPAddress = "";
|
||||
public string HeadResources = "";
|
||||
public string BodyResources = "";
|
||||
public string FavIcon = "favicon.ico";
|
||||
public string PWAScript = "";
|
||||
public string ReconnectScript = "";
|
||||
public string Message = "";
|
||||
|
@ -123,10 +122,6 @@ namespace Oqtane.Pages
|
|||
{
|
||||
RenderMode = site.RenderMode;
|
||||
}
|
||||
if (site.FaviconFileId != null)
|
||||
{
|
||||
FavIcon = Utilities.FileUrl(alias, site.FaviconFileId.Value);
|
||||
}
|
||||
if (Runtime == "Server")
|
||||
{
|
||||
ReconnectScript = CreateReconnectScript();
|
||||
|
|
Loading…
Reference in New Issue
Block a user