mirror of
https://github.com/tabler/tabler.git
synced 2026-06-17 12:50:03 +04:00
Fix: Add missing metadata for Tabler Documentation (#2355)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
Add missing metadata for Tabler Documentation
|
||||
@@ -5,7 +5,7 @@ export function appFilters(eleventyConfig) {
|
||||
if (process.env.ELEVENTY_RUN_MODE === "serve") {
|
||||
eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
|
||||
}
|
||||
|
||||
|
||||
eleventyConfig.setLiquidOptions({
|
||||
timezoneOffset: 0,
|
||||
jekyllInclude: true,
|
||||
@@ -147,6 +147,19 @@ export function appFilters(eleventyConfig) {
|
||||
return elem[0];
|
||||
})
|
||||
|
||||
// Convert a URL path to an absolute URL
|
||||
eleventyConfig.addFilter("absolute_url", function (url) {
|
||||
// Base URL for the site - change this to your production domain
|
||||
const baseUrl = "https://docs.tabler.io";
|
||||
|
||||
// Ensure url starts with a slash
|
||||
if (!url.startsWith('/')) {
|
||||
url = '/' + url;
|
||||
}
|
||||
|
||||
return baseUrl + url;
|
||||
})
|
||||
|
||||
// time ago from today
|
||||
eleventyConfig.addFilter("timeago", function (date) {
|
||||
const seconds = Math.floor((new Date() - date) / 1000);
|
||||
@@ -246,4 +259,4 @@ export function appFilters(eleventyConfig) {
|
||||
|
||||
return '';
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,47 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Tabler Documentation - {{ title }}</title>
|
||||
|
||||
{% assign pageSection = "" %}
|
||||
{% if page.url contains "/ui/" %}
|
||||
{% assign pageSection = "UI" %}
|
||||
{% elsif page.url contains "/icons/" %}
|
||||
{% assign pageSection = "Icons" %}
|
||||
{% elsif page.url contains "/illustrations/" %}
|
||||
{% assign pageSection = "Illustrations" %}
|
||||
{% elsif page.url contains "/emails/" %}
|
||||
{% assign pageSection = "Emails" %}
|
||||
{% endif %}
|
||||
|
||||
{% assign metaTitle = title %}
|
||||
{% if seoTitle %}
|
||||
{% assign metaTitle = seoTitle %}
|
||||
{% endif %}
|
||||
|
||||
{% assign metaDescription = description %}
|
||||
{% if seoDescription %}
|
||||
{% assign metaDescription = seoDescription %}
|
||||
{% endif %}
|
||||
|
||||
{% assign siteName = "Tabler Documentation" %}
|
||||
{% if pageSection != "" %}
|
||||
{% assign siteName = "Tabler " | append: pageSection | append: " Documentation" %}
|
||||
{% endif %}
|
||||
|
||||
<title>{{ metaTitle }} | {{ siteName }}</title>
|
||||
{% if metaDescription %}<meta name="description" content="{{ metaDescription }}">{% endif %}
|
||||
<link rel="canonical" href="{{ page.url | absolute_url }}">
|
||||
|
||||
<!-- Open Graph / Social Media Meta Tags -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="{{ metaTitle }}">
|
||||
{% if metaDescription %}<meta property="og:description" content="{{ metaDescription }}">{% endif %}
|
||||
<meta property="og:site_name" content="{{ siteName }}">
|
||||
|
||||
<!-- Twitter Card data -->
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:title" content="{{ metaTitle }}">
|
||||
{% if metaDescription %}<meta name="twitter:description" content="{{ metaDescription }}">{% endif %}
|
||||
|
||||
<script defer data-api="/stats/event" data-domain="docs.tabler.io" src="/stats/js/script.js"></script>
|
||||
|
||||
@@ -15,7 +55,7 @@
|
||||
rel="stylesheet" />
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
{% if docs-libs -%}
|
||||
{% for lib in libs.css -%}
|
||||
{% if docs-libs contains lib[0] -%}
|
||||
@@ -153,4 +193,4 @@
|
||||
<script src="/dist/js/tabler{% if environment != 'development' %}.min{% endif %}.js"></script>
|
||||
<script src="/js/docs{% if environment != 'development' %}.min{% endif %}.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user