MarkoPress includes production-ready features to help your site rank well in search engines and track visitor analytics.
If you enable the built-in seo plugin (plugins: ['seo']), MarkoPress generates a sitemap at /sitemap.xml that includes:
- All pages, documentation, and blog posts
- Last modification dates
- Change frequencies and priority scores
Submit to search engines:
- Google Search Console:
https://search.google.com/search-console - Bing Webmaster Tools:
https://www.bing.com/webmasters
Generated at /robots.txt when seo.robots is configured, with:
- Allow/disallow rules per user-agent
- Reference to your sitemap
- Configurable crawl-delay and disallow rules
Enable both in one place:
import { defineConfig } from 'markopress';
export default defineConfig({
plugins: ['seo'],
seo: {
sitemap: {
hostname: 'https://yourdomain.com',
},
robots: {
userAgent: '*',
allow: ['/'],
disallow: ['/admin', '/search'],
crawlDelay: 10,
},
},
});Every page automatically includes Open Graph tags for social media sharing:
og:title- Page titleog:description- Page descriptionog:url- Page URL (canonical)og:type- "article" for content, "website" for homepageog:image- Social share image (placeog-image.pnginpublic/)
Twitter Card tags are also included for better Twitter sharing.
Customize social images:
- Create an image:
public/og-image.png(recommended: 1200x630px) - Add
imageto frontmatter in any.mdfile for page-specific images
MarkoPress supports multiple analytics providers. Configure by editing public/analytics.js:
const gaId = 'G-XXXXXXXXXX'; // Your GA4 measurement IDGet your ID: https://analytics.google.com/
const plausibleDomain = 'yourdomain.com'; // Your domainSign up: https://plausible.io/
const umamiId = 'your-website-id'; // Your website IDSign up: https://umami.is/
Track custom events anywhere in your JavaScript:
window.trackEvent('category', 'action', 'label', value);Example:
// Track button clicks
document.querySelector('button').addEventListener('click', () => {
window.trackEvent('engagement', 'button_click', 'cta_button');
});
// Track downloads
window.trackEvent('download', 'pdf', 'user-guide.pdf');Page views are tracked automatically on navigation.
Set these for production deployments:
# Your site URL (for sitemap and canonical URLs)
export SITE_URL="https://yourdomain.com"
# Build and preview
SITE_URL="https://yourdomain.com" npm run build
SITE_URL="https://yourdomain.com" npm run previewBefore deploying to production:
- Configure
SITE_URLenvironment variable - Add
public/og-image.png(1200x630px recommended) - Set up analytics (edit
public/analytics.js) - Test sitemap:
https://yourdomain.com/sitemap.xml - Test robots.txt:
https://yourdomain.com/robots.txt - Test RSS feed:
https://yourdomain.com/api/rss/xml - Submit sitemap to Google Search Console
- Verify analytics tracking is working
- Check Open Graph tags with: https://www.opengraph.xyz/
- Google Search Console: Verify ownership and monitor search performance
- Bing Webmaster Tools: Submit sitemap to Bing
- Rich Results Test: Test structured data: https://search.google.com/test/rich-results
The built-in SEO plugin uses default scoring rules. For custom scoring or filtering, implement your own seo post-build logic or replace it with a custom plugin.
Configure seo.robots in your MarkoPress config:
seo: {
robots: {
userAgent: ['*', 'ChatGPT-User'],
disallow: ['/admin', '/private'],
crawlDelay: 10,
},
}Add to src/routes/+page.marko in the <head> section:
<meta name="author" content="Your Name">
<meta name="keywords" content="your, keywords, here">- Static output -
sitemap.xmlandrobots.txtare generated during build and served as static assets - Use CDN - Serve static assets through a CDN
- Enable compression - Build output is already gzip-compressed
- Monitor Core Web Vitals - Use Google PageSpeed Insights
After deployment, monitor:
- Search Console: Indexing status, search queries, coverage
- Analytics: Visitor metrics, popular pages, referral sources
- Core Web Vitals: LCP, FID, CLS scores