// .vuepress/config.js
const path = require("path");
const host_url = "https://docs.gitcode.net/";
// const static_files = require('./static-files');

const autometa_options = {
  site: {
    name: "PostgreSql 中文文档"
  },
  canonical_base: host_url
};

module.exports = {
  title: "PostgreSql 中文文档",
  base: "/pg/guide/",
  head: [
    [
      "link",
      {
        rel: "icon",
        type: "image/png",
        sizes: "16x16",
        href: `/images/icons/favicon.ico`
      }
    ],
    ["meta", { name: "application-name", content: "PostgreSql 中文文档" }],
    [
      "meta",
      { name: "apple-mobile-web-app-title", content: "PostgreSql 中文文档" }
    ],
    ["meta", { name: "Description", content: "PostgreSql 中文文档" }],
    ["meta", { name: "Keywords", content: "pg, PostgreSql" }],
    [
      "meta",
      { name: "apple-mobile-web-app-status-bar-style", content: "black" }
    ],
    ["link", { rel: "apple-touch-icon", href: `/images/icons/icon_48x48.png` }],
    [
      "link",
      {
        rel: "mask-icon",
        href: "/images/icons/favicon.ico",
        color: "#5dac38"
      }
    ],
    ["meta", { name: "msapplication-TileColor", content: "#5dac38" }],
    ["meta", { name: "theme-color", content: "#5dac38" }],
    [
      "meta",
      { name: "viewport", content: "width=device-width, initial-scale=1" }
    ],
    ["meta", { "http-equiv": "X-UA-Compatible", content: "IE=edge" }],
    ['script', {}, `
    var _hmt = _hmt || [];
    (function () {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?8eefd6b163dcb3f5762af6b0825e2dd1";
      var s = document.getElementsByTagName("script")

[0];
      s.parentNode.insertBefore(hm, s);
    })();
    `]
  ],
  locales: {
    // '/en/': {
    //     lang: 'en-US',
    //     title: '',
    //     description: ''
    // },
    "/": {
      lang: "zh-CN",
      title: "",
      description: ""
    }
  },
  plugins: [
    ["autometa", autometa_options],
    ['sitemap', {
      hostname: host_url,
      // 排除无实际内容的页面
      exclude: ["/404.html"]
    }
    ],
    [
      '@vuepress/last-updated',
      {
        transformer: (timestamp, lang) => {
          const moment = require('moment')
          moment.locale(lang)
          return moment(timestamp).toString()
        }
      }
    ]
  ],
  theme: path.resolve(__dirname, "./themes/theme-gitcode/index.js"),
  themeConfig: {
    repo: "https://gitcode.net/dev-cloud/pg",
    repoLabel: "GitCode",
    docsRepo: "https://gitcode.net/dev-cloud/pg/",
    docsDir: "docs",
    docsBranch: "master",
    editLinks: true,
    editLinkText: "帮助我们改善此页面！",
    lastUpdated: "Last Updated",
    logo: "/images/icons/pg-logo.jpeg",
    sidebarDepth: 3,
    activeHeaderLinks: true,
    locales: {
      // '/en/': {
      //     // 多语言下拉菜单的标题
      //     selectText: 'Language',
      //     // 该语言在下拉菜单中的标签
      //     label: 'English',
      //     lastUpdated: 'Last Updated',
      //     lang: 'en-US',
      //     // 编辑链接文字
      //     editLinkText: 'Edit this page on GitCode',
      //     algolia: {},
      //     sidebar: {
      //         '/en/': static_files("en")
      //     }
      // },
      "/": {
        selectText: "选择语言",
        label: "简体中文",
        ariaLabel: "语言",
        lang: "zh-CN",
        editLinkText: "在 GitCode 上编辑此页",
        lastUpdated: "上次更新",
        algolia: {},
        nav: [
          { text: '参与贡献', link: '/' },
          { text: 'PostgreSQL 中文文档', link: '/index/' }
        ]
        // sidebar: {
        //   "/": ["index.md"],
        // }
      }
    }
  }
};