Merge pull request #84 from madrilene/sustainability

validate carbon.txt
This commit is contained in:
Lene Saile 2025-03-07 17:37:33 +01:00 committed by GitHub
commit ad13985da3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 16 deletions

View file

@ -1,4 +1,6 @@
export const url = process.env.URL || 'http://localhost:8080';
// Extract domain from `url`
export const domain = new URL(url).hostname;
export const siteName = 'Eleventy Excellent';
export const siteDescription = 'Eleventy starter for building modern, resilient websites';
export const siteType = 'Person'; // schema
@ -74,18 +76,15 @@ export const themeSwitch = {
dark: 'dark'
};
export const greenweb = {
// this goes into src/common/greenweb.njk
providers: {
// if you want to add more than one, edit the array directly.
domain: 'netlify.com',
service: 'cdn'
},
credentials: {
// optional, eg: { domain='my-org.com', doctype = 'webpage', url = 'https://my-org.com/our-climate-record'}
domain: '',
doctype: '',
url: ''
}
// https://carbontxt.org/
disclosures: [
{
docType: 'sustainability-page',
url: `${url}/sustainability/`,
domain: domain
}
],
services: [{domain: 'netlify.com', serviceType: 'cdn'}]
};
export const viewRepo = {
// this is for the view/edit on github link. The value in the package.json will be pulled in.

View file

@ -3,7 +3,15 @@ permalink: /carbon.txt
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
[upstream] providers = [{ domain = '{{ meta.greenweb.providers.domain }}', service =
'{{ meta.greenweb.providers.service }}' }] [org] credentials =
[{% if meta.greenweb.credentials.domain %}{ domain = '{{ meta.greenweb.credentials.domain }}', doctype =
'{{ meta.greenweb.credentials.doctype }}', url = '{{ meta.greenweb.credentials.url }}' }{% endif %}]
[org]
disclosures = [
{%- if meta.greenweb.disclosures | length >= 1 and meta.greenweb.disclosures[0].domain != '' -%}
{% for disclosure in meta.greenweb.disclosures %}
{ doc_type='{{ disclosure.docType }}', url='{{ disclosure.url }}', domain='{{ disclosure.domain }}' }{%- if not loop.last -%},{% endif %}{% endfor %}{% endif %}
]
{% if meta.greenweb.services | length >= 1 and meta.greenweb.services[0].domain != '' %}
[upstream]
services = [
{% for service in meta.greenweb.services %}{ domain='{{ service.domain }}', service_type='{{ service.serviceType }}' }{%- if not loop.last -%},{% endif %}{% endfor %}
]
{% endif %}

View file

@ -0,0 +1,11 @@
---
title: Sustainability
layout: page
eleventyExcludeFromCollections: true
excludeFromSitemap: true
permalink: /sustainability/index.html
---
**Carbon Footprint**: This Website has a A+ Carbon Rating. [View full analysis on websitecarbon.com](https://www.websitecarbon.com/website/eleventy-excellent-netlify-app/)
Only 0.02 g of CO2 is produced every time someone visits this web page.