mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-07 05:05:20 +00:00
Support baseURL in env file for sitemap generation
This commit is contained in:
parent
e61261eaae
commit
4b49875dfa
@ -22,12 +22,17 @@ module.exports = async() => {
|
|||||||
const res = await axios.get(themeUrl);
|
const res = await axios.get(themeUrl);
|
||||||
themeStyle = `<style>${res.data}</style>`;
|
themeStyle = `<style>${res.data}</style>`;
|
||||||
}
|
}
|
||||||
|
let baseUrl = process.env.SITE_BASE_URL || "";
|
||||||
|
if(baseUrl && !baseUrl.startsWith("http")){
|
||||||
|
baseUrl = "https://" + baseUrl;
|
||||||
|
}
|
||||||
const meta ={
|
const meta ={
|
||||||
env: process.env.ELEVENTY_ENV,
|
env: process.env.ELEVENTY_ENV,
|
||||||
theme: process.env.THEME,
|
theme: process.env.THEME,
|
||||||
themeStyle: themeStyle,
|
themeStyle: themeStyle,
|
||||||
baseTheme: process.env.BASE_THEME || "dark",
|
baseTheme: process.env.BASE_THEME || "dark",
|
||||||
siteName: process.env.SITE_NAME_HEADER || "Digital Garden",
|
siteName: process.env.SITE_NAME_HEADER || "Digital Garden",
|
||||||
|
siteBaseUrl: baseUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
return meta;
|
return meta;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
permalink: netlify/functions/search/data.json
|
permalink: netlify/functions/search/data.json
|
||||||
permalinkBypassOutputDir: true
|
permalinkBypassOutputDir: true
|
||||||
|
eleventyExcludeFromCollections: true
|
||||||
---
|
---
|
||||||
[{% for post in collections.note %}
|
[{% for post in collections.note %}
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,9 @@ eleventyExcludeFromCollections: true
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
{% for page in collections.all %}
|
{% for page in collections.all %}
|
||||||
{%if page.url !== '/netlify/functions/search/data.json'%}
|
|
||||||
<url>
|
<url>
|
||||||
<loc>{{ site.url }}{{ page.url | url }}</loc>
|
<loc>{{ meta.siteBaseUrl }}{{ page.url | url }}</loc>
|
||||||
<lastmod>{{ page.date.toISOString() }}</lastmod>
|
<lastmod>{{ page.date.toISOString() }}</lastmod>
|
||||||
</url>
|
</url>
|
||||||
{%endif%}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</urlset>
|
</urlset>
|
Loading…
x
Reference in New Issue
Block a user