jsakamoto / BlazorWasmPreRendering.Build

When you publish your Blazor Wasm app, this package pre-renders and saves the app as static HTML files in your public folder.
https://jsakamoto.github.io/BlazorWasmPreRendering.Build/
Mozilla Public License 2.0
261 stars 15 forks source link

Duplicate conflicting <title>, <meta descripiton=""> and schema.org components #33

Open nakigoe opened 1 year ago

nakigoe commented 1 year ago

@jsakamoto 様 いつもお世話になっております thank you for your hard work! Your extension is working for my website https://nakigoe.org

The only problem I encounter now is that I have to remove all the SEO from the wwwroot/index.html, since the extension generates conflicting SEO components. It takes them both from wwwroot/index.html and from every page indexed by the extension:

There is a lot of manual labour ahead now for every single page, to fix the SEO data.

What the appropriate solution might be to remove the duplicates, since it might not be the best idea to remove the <title>nakigoe.org</title> tag from the static wwwroot/index.html, since every page requires a <title></title> tag by W3 standards.

jsakamoto commented 11 months ago

Hi @nakigoe,

Unfortunately, I've no good idea for the moment. Because that behaviour you encounted is based on the architecture of Blazor's built-in PageTitle and HeadContent components.

However, I can not strongly recommend it to you, but there is one alternative way. It is what using the "Toolbelt.Blazor.HeadElement" library instead of using the Blazor-built-in PageTitle and HeadContent components.

https://github.com/jsakamoto/Toolbelt.Blazor.HeadElement/

The "Toolbelt.Blazor.HeadElement" library also has some disadvantages and difficulties in use, so it is not perfect for replacing Blazor's built-in components. But the "Toolbelt.Blazor.HeadElement" library eliminates duplication of and <meta> elements put in the "wwwroot/index.html" by default.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ElderJames"><img src="https://avatars.githubusercontent.com/u/7550366?v=4" />ElderJames</a> commented <strong> 1 month ago</strong> </div> <div class="markdown-body"> <p>I think we can run a command after the html generated that remove the first title element.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>