webmasterish / vuepress-plugin-autometa Goto Github PK
View Code? Open in Web Editor NEWAuto meta tags plugin for VuePress 1.x
License: MIT License
Auto meta tags plugin for VuePress 1.x
License: MIT License
Better customisation of image source selection
I would be able to programatically choose the image source in frontmatter, using a string path or perhaps a function:
image_sources: [
page => page.frontmatter.media.thumbnail || page.frontmatter.image
],
It seems the code only picks a frontmatter node called image
but I want to pick one at media.thumbnail
Also, when the code moves on to use regex to grab a page tag, it ends up with:
<meta name="twitter:image" content="https://davestewart.co.uk/./screens/loading.png">
Also, note that this link shows a path relative the actual page - is there some way to get round this?
In my own code, I resolve the path and then require()
.
The compiled page (the image was just in markdown) actually shows this:
<img src="/assets/img/loading.143ab32a.png" alt="">
N/A
Sorry removed this as didn't think it was a bug before.
But, Node 12, latest everything else.
Great plugin, thanks for your hard work!
Change PATH.join
to URL.resolve
for URLs in the following lines:
vuepress-plugin-autometa/index.js
Line 253 in 0192b42
vuepress-plugin-autometa/index.js
Line 499 in 0192b42
Can you please make it support VuePress 2.x?
Autometa has not catch the rewritten by another extended function.
This problem may be a problem to be solved by the Vuepress core in the future, such as setting the execution order of plugins.
What do you think about this problem?
before
module.exports = ( plugin_options, context ) => ({
extendPageData ( $page ) {
const { frontmatter } = $page;
...
after
module.exports = ( plugin_options, context ) => ({
ready () {
const { pages } = context
pages.forEach( page => {
const { frontmatter } = page;
...
/about.md
---
title: Hello
permalink: about-page
---
# About
output
/about-page/index.html
<!DOCTYPE html>
<head>
<meta name="twitter:url" content="https://example.com/about-page/">
...
/about.md
---
title: Hello
permalink: about-page
---
# About
output
/about-page/index.html
<!DOCTYPE html>
<head>
<meta name="twitter:url" content="https://example.com/about.html">
...
sorry, I'm using translation.
love this plugin. thanks!
The VuePress documentation recommends to use $withBase()
to include images when the site is deployed at a non root url:
<img :src="$withBase('/img/logo.svg')" alt="logo" />
I'd expect that the url is computed correctly, based on the vuepress config.
Generated is this:
<meta property="og:image" content="https://example.com/$withBase(">
Put the img tag as stated above in your md file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.