Added Open Graph to Category Pages
This commit is contained in:
		
							parent
							
								
									f5949b1bca
								
							
						
					
					
						commit
						f61188784d
					
				|  | @ -1,4 +1,5 @@ | |||
| @using Microsoft.Extensions.Options | ||||
| @using System.Net | ||||
| @using Microsoft.Extensions.Options | ||||
| @using Wave.Data | ||||
| @using Wave.Utilities | ||||
| 
 | ||||
|  | @ -53,6 +54,20 @@ | |||
| 		<link rel="alternate" type="application/rss+xml" title="RSS Feed on @Customizations.Value.AppName | User @user.FullName" href="@Navigation.ToAbsoluteUri("/rss/rss.xml?author=@user.Id")"> | ||||
| 		<link rel="alternate" type="application/atom+xml" title="Atom RSS Feed on @Customizations.Value.AppName | User @user.FullName" href="@Navigation.ToAbsoluteUri("/rss/atom.xml?author=@user.Id")"> | ||||
| 	} | ||||
| } else if (Subject is Category category) { | ||||
| 	<meta property="og:title" content="@Localizer!["Title"] - @category.Name"> | ||||
| 	<meta property="og:description" content="Articles in the @category.Name Category on @Customizations.Value.AppName"> | ||||
| 	<meta property="og:type" content="website" /> | ||||
| 	@if (!string.IsNullOrWhiteSpace(Customizations.Value.LogoLink)) { | ||||
| 		<meta property="og:image" content="@Customizations.Value.LogoLink"> | ||||
| 	} else { | ||||
| 		<meta property="og:image" content="@Navigation.ToAbsoluteUri("/img/logo.png")"> | ||||
| 	} | ||||
| 
 | ||||
| 	@if (Features.Value.Rss) { | ||||
| 		<link rel="alternate" type="application/rss+xml" title="RSS Feed on @Customizations.Value.AppName | @category.Name" href="@Navigation.ToAbsoluteUri("/rss/rss.xml?category=" + WebUtility.UrlEncode(category.Name))"> | ||||
| 		<link rel="alternate" type="application/atom+xml" title="Atom RSS Feed on @Customizations.Value.AppName | @category.Name" href="@Navigation.ToAbsoluteUri("/rss/atom.xml?category=" + WebUtility.UrlEncode(category.Name))"> | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @code { | ||||
|  |  | |||
|  | @ -2,19 +2,14 @@ | |||
| @using Microsoft.EntityFrameworkCore | ||||
| @using Wave.Data | ||||
| @using System.Net | ||||
| @using Microsoft.Extensions.Options | ||||
| 
 | ||||
| @inject IDbContextFactory<ApplicationDbContext> ContextFactory | ||||
| @inject IOptions<Customization> Customizations | ||||
| @inject IOptions<Features> Features | ||||
| @inject IStringLocalizer<CategoryView> Localizer | ||||
| 
 | ||||
| <HeadContent> | ||||
| 	@if (Features.Value.Rss && Category is not null) {  | ||||
| 		<link rel="alternate" type="application/rss+xml" title="RSS Feed on @Customizations.Value.AppName | @Category.Name" href="/rss/rss.xml?category=@WebUtility.UrlEncode(Category.Name)"> | ||||
| 		<link rel="alternate" type="application/atom+xml" title="Atom RSS Feed on @Customizations.Value.AppName | @Category.Name" href="/rss/atom.xml?category=@WebUtility.UrlEncode(Category.Name)"> | ||||
| 	} | ||||
| 	@if (Category is null) { | ||||
| 	@if (Category is not null) { | ||||
| 		<OpenGraph Subject="Category" Localizer="Localizer" /> | ||||
| 	} else { | ||||
| 		<meta name="robots" content="noindex"> | ||||
| 	} | ||||
| </HeadContent> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue