mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-05 21:47:48 +01:00
Enhancement: Allow Disabling Indexing (#5954)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b6b428363c
commit
1a21189643
@@ -571,3 +571,18 @@ or per service widget (`services.yaml`) with:
|
|||||||
```
|
```
|
||||||
|
|
||||||
If either value is set to true, the error message will be hidden.
|
If either value is set to true, the error message will be hidden.
|
||||||
|
|
||||||
|
## Disable Search Engine Indexing
|
||||||
|
|
||||||
|
You can request that search engines not to index your Homepage instance by enabling the `disableIndexing` setting.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
disableIndexing: true
|
||||||
|
```
|
||||||
|
|
||||||
|
When enabled, this will:
|
||||||
|
|
||||||
|
- Disallow all crawlers in `robots.txt`
|
||||||
|
- Add `<meta name="robots" content="noindex, nofollow">` tags to prevent indexing
|
||||||
|
|
||||||
|
By default this feature is disabled.
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ function Home({ initialSettings }) {
|
|||||||
"A highly customizable homepage (or startpage / application dashboard) with Docker and service API integrations."
|
"A highly customizable homepage (or startpage / application dashboard) with Docker and service API integrations."
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
{settings.disableIndexing && <meta name="robots" content="noindex, nofollow" />}
|
||||||
{settings.base && <base href={settings.base} />}
|
{settings.base && <base href={settings.base} />}
|
||||||
{settings.favicon ? (
|
{settings.favicon ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
19
src/pages/robots.txt.js
Normal file
19
src/pages/robots.txt.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { getSettings } from "utils/config/config";
|
||||||
|
|
||||||
|
export async function getServerSideProps({ res }) {
|
||||||
|
const settings = getSettings();
|
||||||
|
const content = ["User-agent: *", !!settings.disableIndexing ? "Disallow: /" : "Allow: /"].join("\n");
|
||||||
|
|
||||||
|
res.setHeader("Content-Type", "text/plain");
|
||||||
|
res.write(content);
|
||||||
|
res.end();
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function RobotsTxt() {
|
||||||
|
// placeholder component
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user