As of right now, we don't even have meta descriptions:
the source code for this page https://dev.lemmy.ml/#/post/28664 shows:
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/favicon.svg" />
<link rel="apple-touch-icon" href="/static/assets/apple-touch-icon.png" />
<link rel="stylesheet" href="/static/assets/libs/balloon-css/balloon.min.css">
<script src="/static/assets/libs/sortable/sortable.min.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="/static/a30a7621-app.js"></script>
</body>
</html>
Crawlers/bots need more info in order to index pages correctly.
We'd need to find the SEO best practices and apply them.
We could use as a guide this: https://backlinko.com/on-page-seo (this is a general purpose article, not everything applies to lemmy, but most of it I'd say)
I can add some of these tags, but the most important one, title, is loaded dynamically after the page load, using react router (well actually inferno's router), being a single page web app. So right now I'm dynamically fetching the page title based on where you're routing to, and it changes. I'd need to know how other react / single page web apps handle this.
Obvi since this isn't ever going to have ads or be funded by them, SEO is less important to me than it would be otherwise.
Obvi since this isn't ever going to have ads or be funded by them, SEO is less important to me than it would be otherwise.
But SEO is not about that. SEO stands for Search Engine Optimization and it is only needed so that search engines (DuckDuckGo, Bing, etc.) can find and crawl a website correctly and rank it accordingly.
Also consider that a user/community needs to be able to prevent their content from being shown in search engines. Reddit has this functionality in account settings.
I'm def willing to do it, I just need some expertise from other react routing experts or good articles on the best way to do it.
dup of #155
dup of #155
How? They are 100% not related. The fact that because of JS, source code of pages can't be indexed by crawlers is just one issue/optimization for SEO. But there are many more, like creating a robots.txt file, xml file, etc.. there are many SEO optimizations that a website can make use of.
PRs welcome.
As far as I know of search engine bots have problems when crawling client-side generated code. So if the server is just sending a plain JS file, crawlers will have problems with it (they will not be able to crawl title, description, etc...) this is the reason why there are applications which do server rendering of React components or why yew is a thing (by recreating a virtual dom like React has already done).
I think google can crawl some js sites now, a part of it tho also is the dev instance is using hash routing, IE # in the urls, which crawlers don't support yet. Another thing I'm also going to try out, is turning it into an isomorphic app, so that js won't be fully necessary on first page load, addressed in #155
Yes, an isomorphic app would solve this particular problem but with a Rust back-end how are you going to do that?
The first principle of the isomorphic app is to be able to call renderToString() on the server and send to the client somewhat-rendered components which you cannot do on a Rust back-end without any contrived code.
https://infernojs.org/docs/guides/isomorphic
The renderToString would be local, from a node server, express, to the locally running rust instance, and would pull all the data before sending to the client.
I've recently added the browserrouter which might help with this. Does anyone know of any good SEO tester?
I've recently added the browserrouter which might help with this. Does anyone know of any good SEO tester?
The audits tab of the Chrome console is pretty good.
I'll close this but any new SEO related specific things can be re-opened.
Most helpful comment
Also consider that a user/community needs to be able to prevent their content from being shown in search engines. Reddit has this functionality in account settings.