mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +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);
|
||||
themeStyle = `<style>${res.data}</style>`;
|
||||
}
|
||||
let baseUrl = process.env.SITE_BASE_URL || "";
|
||||
if(baseUrl && !baseUrl.startsWith("http")){
|
||||
baseUrl = "https://" + baseUrl;
|
||||
}
|
||||
const meta ={
|
||||
env: process.env.ELEVENTY_ENV,
|
||||
theme: process.env.THEME,
|
||||
themeStyle: themeStyle,
|
||||
baseTheme: process.env.BASE_THEME || "dark",
|
||||
siteName: process.env.SITE_NAME_HEADER || "Digital Garden",
|
||||
siteBaseUrl: baseUrl,
|
||||
};
|
||||
|
||||
return meta;
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
permalink: netlify/functions/search/data.json
|
||||
permalinkBypassOutputDir: true
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
[{% for post in collections.note %}
|
||||
{
|
||||
|
@ -5,11 +5,9 @@ eleventyExcludeFromCollections: true
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{% for page in collections.all %}
|
||||
{%if page.url !== '/netlify/functions/search/data.json'%}
|
||||
<url>
|
||||
<loc>{{ site.url }}{{ page.url | url }}</loc>
|
||||
<loc>{{ meta.siteBaseUrl }}{{ page.url | url }}</loc>
|
||||
<lastmod>{{ page.date.toISOString() }}</lastmod>
|
||||
</url>
|
||||
{%endif%}
|
||||
{% endfor %}
|
||||
</urlset>
|
Loading…
x
Reference in New Issue
Block a user