-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature Request: Support Next.js App Router File Conventions for Favicons #509
Comments
Thank you Lars for the detailed request! I'm a Next.js dev myself, and the new version of RealFavicon is a Next.js app btw. Why it is done this wayCurrently RealFavicon doesn't follow Next favicon conventions for two reasons: Partial favicon file supportAlthough Next supports many favicon-related conventions, it doesn't support all files created by RealFavicon: icons referenced by the web manifest are not covered. Therefore, they cannot be placed into the If RealFavicon was to use Next conventions, the instructions would tell to put "most" files in Control over HTML markupsMarkups created by RealFavicon are tested and the results are published. What about the markups generated by Next? Do they work? Are they similar to the ones generated by RealFavicon? Are they consistent from Next 14 to 15? What'll happen in Next 16? What is their order? (the order used to matter years ago when Firefox didn't take the The promise of RealFavicon is to give you icons and code that work. Relying on Next conventions would make you walk the last few steps alone, without this guarantee. Other considerationsConventions are useful... when you don't use RealFaviconNext conventions are helpful when you craft your icons manually: at least, you don't have to type those boring markups thanks to Next. But with RealFavicon, the HTML is not an issue either because it is computed for you. Conventions matterI don't want to dismiss Next conventions too quickly. When a new dev works on an existing app, he may wonder where the favicon assets are ("why are they not in the And, again, as a Next dev myself, I would like to follow these conventions just for the sake of sticking to the rules. ConclusionRealFavicon instructions for Next.js are what they are because they are pragmatic. They are easy to follow, and your favicon will work as expected. Yet, I would be glad to reconsider if there was a way to work around the issues above. |
@phbernard Thanks for your comments! I totally understand your perspective. However, since many developers use these file conventions, could we consider adding this feature as an optional extension? It wouldn’t alter the core tool but would provide an “include app directory files” option, supporting those following Next.js file structures. This way, the tool stays consistent but also supports Next.js users. Right now, many end up renaming files manually, which could be simplified with this extra feature. |
Support both ways? Yep, that could work! Thank you @LarsFlieger for the proposal. |
Yes, exactly. We could also integrate a link to RealFaviconGenerator in the Next.js docs to help others create favicons more efficiently. |
Nice work! Unfortunately, I don't, but I can create a suggestion in the form of an issue in their repo or even submit a PR with that change. I think this is super useful and would help many Next.js apps create good favicons/SEO files for their projects. |
@phbernard One thing, there is a bug: Unfortunately, it's not possible to differentiate files by their format. If you do it this way, only one of them gets inserted into the HTML.
Result: <link rel="icon" href="/icon.png?fbdb9a3e2885e9bf" type="image/png" sizes="96x96">
<!-- svg is missing :/ --> It has to be:
or as the docs suggested:
Result: <link rel="icon" href="/icon1.svg?95677549cd7c5972" type="image/svg+xml" sizes="any">
<link rel="icon" href="/icon2.png?fbdb9a3e2885e9bf" type="image/png" sizes="96x96"> |
Description
With the introduction of the new App Router in Next.js (since version 13), Next.js has adopted a convention where placing files with specific names directly into the
app
directory allows the framework to automatically include the correct HTML code for favicons and metadata. This simplifies the process by eliminating the need to manually insert HTML tags for favicons.Currently, RealFaviconGenerator does not support this convention.
It generates favicon files and accompanying HTML code that don't align with Next.js's new file naming requirements, making it less seamless for developers using the latest Next.js versions.
Problem
<head>
tag, which is not necessary with Next.js's new approach.Expected Behavior
app
directory and have Next.js automatically handle them.Actual Behavior
Proposed Solution
favicon.ico
,icon.png
,apple-touch-icon.png
).app
directory to leverage automatic inclusion.References
Additional Context
Supporting Next.js's new conventions would greatly enhance the developer experience for those using RealFaviconGenerator in conjunction with Next.js. It would streamline the favicon setup process and ensure compatibility with modern web development practices.
Thank you for considering this feature request!
The text was updated successfully, but these errors were encountered: