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

Blazor WASM SEO issues #39137

Closed
keerthirajap opened this issue Dec 21, 2021 · 5 comments
Closed

Blazor WASM SEO issues #39137

keerthirajap opened this issue Dec 21, 2021 · 5 comments
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update.

Comments

@keerthirajap
Copy link

keerthirajap commented Dec 21, 2021

Blazor WASM needs simple and quick solution on SEO for rendering Title, Meta and Link tags on Twitter and Facebook cards.

bing webmasters is showing errors on using PageTitle and HeadContent tags.

Provide inbuilt option for Robot.txt and sitemap.xml

@TanayParikh TanayParikh added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Dec 21, 2021
@keerthirajap
Copy link
Author

keerthirajap commented Dec 21, 2021

I temporarily resolved by using prerender.io and cloudflare.com services for the website launched in IIS, by following the blog : https://www.baskaran.dev/posts/2021/1/blazor-seo-prerendering

Pre-render with IIS is more efficient
https://github.com/dingyuliang/prerender-dotnet/wiki/Prerender-Configuration-in-IIS

Also please add 404 error pages

web.config

     <rules>         
	  
          
			
			
		  <rule name="Redirect to https" stopProcessing="true">
           <match url=".*" />
           <conditions>
              <add input="{HTTPS}" pattern="off" ignoreCase="true" />
           </conditions>
           <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
        </rule>
        <rule name="non-www to www" stopProcessing="true">
           <match url="(.*)" />
           <conditions>
              <add input="{HTTP_HOST}" pattern="^domain.com$" />
           </conditions>
           <action type="Redirect" url="https://www.domain.com/{R:1}" redirectType="Permanent" />
        </rule>


		 <rule name="RewriteSEO" stopProcessing="true">      
				<serverVariables>
                        <set name="HTTP_X_PRERENDER_TOKEN" value="your token" />
					</serverVariables>
					
                 <match url="^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.webmanifest|\.torrent))(.*)" ignoreCase="false" />
               
				<conditions logicalGrouping="MatchAny">
                        <add input="{QUERY_STRING}" pattern="(.*)_escaped_fragment_=(.*)" ignoreCase="false" />
                        <add input="{HTTP_USER_AGENT}" pattern="(baiduspider)|(facebookexternalhit)|(twitterbot)|(rogerbot)|(linkedinbot)|(embedly)|(quora link preview)|(showyoubot)|(outbrain)|(pinterest)|(google\\.com)|(slackbot)|(vkShare)|(W3C_Validator)|(redditbot)|(Applebot)|(WhatsApp)|(flipboard)|(tumblr)|(bitlybot)|(SkypeUriPreview)|(nuzzel)|(discordbot)|(Google Page Speed)|(x\\-bufferbot)|(qwantify)|(pinterestbot)|(bitrix link preview)|(xing-contenttabreceiver)|(chrome-lighthouse)|(telegrambot)|(bot)|(developers.google.com/+/web/snippet)|(googlebot)|(yahoo! slurp)|(bingbot)|(yandex)|(bot)|(spider)|(spyder)|(crawler)|(seobility)" />
                </conditions>
                <action type="Rewrite" url="{ToLower:https://service.prerender.io/https://www.domain.com/{R:2}}" appendQueryString="false" logRewrittenUrl="true" />
					
            </rule>
			
		 	 <rule name="Rewrite brotli file" stopProcessing="true">
			  <match url="(.*)" />
			  <conditions>
				<add input="{HTTP_ACCEPT_ENCODING}" pattern="br" />
				 <add input="{REQUEST_FILENAME}" pattern="\.(js|dat|dll|json|wasm|blat|htm|html|css|ico|svg)$" />
				<add input="{REQUEST_FILENAME}.br" matchType="IsFile" />
			  </conditions>
			  <action type="Rewrite" url="{R:1}.br" />
			</rule>		
	
		 <rule name="Rewrite gzip file" stopProcessing="true">
		  <match url="(.*)" />
		  <conditions>
			<add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" />
			<add input="{REQUEST_FILENAME}" pattern="\.(js|dat|dll|json|wasm|blat|htm|html|css|ico|svg)$" />
			<add input="{REQUEST_FILENAME}.gz" matchType="IsFile" />
		  </conditions>
		  <action type="Rewrite" url="{R:1}.gz" />
		</rule>	

     </rules>
  </rewrite>

@TanayParikh TanayParikh added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Dec 21, 2021
@pranavkm
Copy link
Contributor

@mkArtakMSFT mkArtakMSFT added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 3, 2022
@ghost
Copy link

ghost commented Jan 3, 2022

Hi @keerthirajap. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@keerthirajap
Copy link
Author

I tried it, Its not working with dependency injection and Authentication, Authorization.

I am asking this support for WASM only, but your link says we need to have in server and client project.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Jan 5, 2022
@javiercn
Copy link
Member

Closing this issue in favor of #27592 since it's a duplicate.

Please upvote the other feature instead.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update.
Projects
None yet
Development

No branches or pull requests

5 participants