当前位置: 首页 > wzjs >正文

wordpress本站导航在哪里青岛网站建设哪家权威

wordpress本站导航在哪里,青岛网站建设哪家权威,企业做网站需要做哪些工作,目前最好用的网络管理软件要构建SSG静态站点时,一般为了方便增加algolia搜索框,但这里algolia配置使用时用很多的坑,折腾了我好几天,网上没有一个可用的教程。 自己弄了几天,终于搞明白里面的道道了,现在分享出来给大家,…

要构建SSG静态站点时,一般为了方便增加algolia搜索框,但这里algolia配置使用时用很多的坑,折腾了我好几天,网上没有一个可用的教程。
自己弄了几天,终于搞明白里面的道道了,现在分享出来给大家,避免踩坑。
前面注册的就不用了。

比如:用的docusaurus、vitepress构建SSG静态站点,安装algolia依赖的,都会有algolia的设置。此处不讲这些简单的。
先看效果图:
image

algolia设置步骤

  • docusaurus、vitepress设置appid、key、抓取配置等
  • algolia新建app
  • 创建爬虫
  • 设置索引

实操说明

下面以我自构建的一个gulp文档静态站点:https://gulpjs.uihtm.com 为演示,一步步怎么设置完成的。

静态站配置algolia密钥、索引名、appid

本站点是使用docusaurus来构建静态站点的,在docusaurus.config.js配置文件里有一个设置algolia的appIdapiKeyindexName
image

algolia: {appId: 'XQC8CUNYC9',apiKey: '1fe23b551c6d578e296aeb91ef858c2e',indexName: 'deploy-gulpjs',contextualSearch: true,searchParameters: {facetFilters: ['language:zh-CN']}}

这里的appIdapiKeyindexName对应的是algolia后台:https://dashboard.algolia.com/ 面板里的。
先在后台创建应用才能得到appid、apikey,

创建应用

image

选择地域区,随便选一个

image

image

创建完点击应用就可以对相应应用设置

image

apikey在这里:Search API Key

image

image

algolia 索引index创建

点击这里的serach就会到index页面,

image

默认索引里的,recordsrecord size是空的0,点击event data进去,再点Crawler爬取设置

image

image

设置爬虫

创建爬虫,爬虫可以创建多个的,其实只需要一个就够了。到时验证域名,点击爬虫名称,进入爬取设置

image

image

点击Resume crawling 会自动爬取域名里的网址,爬取前可以设置,爬取的开始域名,最有url数和爬取周期

image

这里就是爬取完的显示,这是有爬取完成的url数量,url里的记录数,


注意这里的Indices,

  • 这里有个名称为:deploy-gulpjs,的索引名。是填到静态站点配置里的,
  • 索引是可以有多个
  • 如果没设置edtor,爬取出来的索引是随机名,后面可以重命名
  • 注意索引有没有records记录

image

在爬取过程,有一个deploy-gulpjs.tmp的名称,在爬完后自动消失。

image

自定义爬虫设置

在这里点击editor,可以设置测试爬取内容等配置。
image

image

可以编辑里面的json参数设置爬取。代码里的indexName: "deploy-gulpjs",就是我设置爬取后生成的索引名称,还有一点是站点语言,一般

new Crawler({appId: "xxxxxx",indexPrefix: "",rateLimit: 8,maxUrls: null,schedule: "on the 12 day of the month",startUrls: ["https://gulpjs.uihtm.com"],renderJavaScript: false,sitemaps: ["https://gulpjs.uihtm.com/sitemap.xml"],ignoreCanonicalTo: true,discoveryPatterns: ["https://gulpjs.uihtm.com/**"],actions: [{indexName: "deploy-gulpjs",pathsToMatch: ["https://gulpjs.uihtm.com/**"],recordExtractor: ({ $, helpers }) => {const lvl0 =$(".menu__link.menu__link--sublist.menu__link--active, .navbar__item.navbar__link--active",).last().text() || "Documentation";const records = helpers.docsearch({recordProps: {lvl0: {selectors: "",defaultValue: "gulpjs",},lvl1: ["header h1", "article h1"],lvl2: "article h2",lvl3: "article h3",lvl4: "article h4",lvl5: "article h5, article td:first-child",lvl6: "article h6",content: "article p, article li, article td:last-child",},aggregateContent: true,recordVersion: "v3",});// 设置中文records.forEach((record) => {record.lang = "zh-CN";});return records;},},],safetyChecks: { beforeIndexPublishing: { maxLostRecordsPercentage: 30 } },initialIndexSettings: {deployGulpjs: {attributesForFaceting: ["type","lang","language","version","docusaurus_tag",],attributesToRetrieve: ["hierarchy","content","anchor","url","url_without_anchor","type",],attributesToHighlight: ["hierarchy", "content"],attributesToSnippet: ["content:10"],camelCaseAttributes: ["hierarchy", "content"],searchableAttributes: ["unordered(hierarchy.lvl0)","unordered(hierarchy.lvl1)","unordered(hierarchy.lvl2)","unordered(hierarchy.lvl3)","unordered(hierarchy.lvl4)","unordered(hierarchy.lvl5)","unordered(hierarchy.lvl6)","content",],distinct: true,attributeForDistinct: "url",customRanking: ["desc(weight.pageRank)","desc(weight.level)","asc(weight.position)",],ranking: ["words","filters","typo","attribute","proximity","exact","custom",],highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',highlightPostTag: "</span>",minWordSizefor1Typo: 3,minWordSizefor2Typos: 7,allowTyposOnNumericTokens: false,minProximity: 1,ignorePlurals: true,advancedSyntax: true,attributeCriteriaComputedByMinProximity: true,removeWordsIfNoResults: "allOptional",},},apiKey: "xxxxxxx",
});

看你的静态站点html是设置什么语言,lang="zh-CN",那对应要json参数设置爬取
image

// 设置中文
records.forEach((record) => {record.lang = "zh-CN";
});

image
image

重点,索引设置

索引设置里的Searchable attributesFacetsLanguage
image

image

image

image

最后有这样的数据出来就大功告成了。
image

http://www.dtcms.com/wzjs/803602.html

相关文章:

  • php网站建设工程师郑州seo顾问
  • app开发的网站怎么做出有品牌感的网站
  • dede网站安全工商信息查询
  • xps13适合网站开发吗网站建设html模板下载
  • 无锡优化网站业务电子商务网站的建设过程
  • 网站和域名wordpress转义
  • 帮做试卷的网站自己做网站 教程
  • jsp网站怎么做邮箱验证码做网站费用怎么核算
  • 公司做网站建设阴阳师网站怎么做
  • 静安区网站建设编程自己做网站
  • wordpress短信登陆seo外链怎么发
  • 襄阳市建设工程造价管理站网站南宁在百度上建网站
  • 常熟建设银行 招聘网站网站开发策划书
  • 企业网站备案号密码忘记晋城建设工程信息网站
  • 服务器购买网站什么静态网站容易做
  • 网页qq登陆保护功能怎么关闭宁波seo网站排名
  • 乐清 做网站 多少钱网站制作公司兴田德润简介
  • wordpress中英文网站外贸软件的建立
  • step7用法fc州网站建设app制作怎样可以快速
  • 做公司网站的2022年免费云服务器
  • 成都网站只找做企业网站
  • 外贸建站有哪些公司网站建设服务费交印花税吗
  • 网站开发技术网站使用特殊字体
  • 网站可以做固定资产吗宁津有培训做网站的
  • 建设网站市场规模网站建设都怎么找客户的
  • 铜仁建设局网站首页网络维护服务合同模板
  • 网站建设方面的书籍什么是互联网营销师
  • 手机网站设计wordpress禁止采集
  • 南昌门户网站建设网站建设 国家技术规范
  • 环保网站建设维护情况报告盐城专业网站建设哪家好