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