feat: enhance SEO with sitemap and robots.txt, add Open Graph and Twitter meta tags
This commit is contained in:
11
.eleventy.js
11
.eleventy.js
@@ -6,6 +6,9 @@ module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPassthroughCopy("src/resume");
|
||||
eleventyConfig.addPassthroughCopy("src/assets/images");
|
||||
eleventyConfig.addPassthroughCopy({ "favicon" : "/" } );
|
||||
eleventyConfig.addPassthroughCopy({ 'src/robots.txt': '/robots.txt' });
|
||||
eleventyConfig.addPassthroughCopy({ 'src/sitemap.xml': '/sitemap.xml' });
|
||||
|
||||
// Add a filter for readable dates using vanilla JS
|
||||
eleventyConfig.addFilter("readableDate", dateObj => {
|
||||
// The toLocaleDateString method can be used to format dates
|
||||
@@ -19,6 +22,14 @@ module.exports = function(eleventyConfig) {
|
||||
});
|
||||
});
|
||||
|
||||
// Add htmlDateString filter for sitemap <lastmod>
|
||||
eleventyConfig.addFilter("htmlDateString", dateObj => {
|
||||
if (!dateObj) return "";
|
||||
// Format date as YYYY-MM-DD for sitemaps
|
||||
const d = new Date(dateObj);
|
||||
return d.toISOString().split("T")[0];
|
||||
});
|
||||
|
||||
// Shortcode for creating a callout box
|
||||
// This is a "paired shortcode" which means it has a start and end tag.
|
||||
eleventyConfig.addPairedShortcode("callout", function(content, title) {
|
||||
|
Reference in New Issue
Block a user