Import nuxt at config file

This commit is contained in:
Sam Carlton 2021-01-19 23:50:44 -06:00
parent 085dfff323
commit a5c297d2d6
2 changed files with 13 additions and 5 deletions

View file

@ -1,9 +1,17 @@
// const eleventyVue = require("@11ty/eleventy-plugin-vue"); // const eleventyVue = require("@11ty/eleventy-plugin-vue");
import nuxtConfig from './nuxt.config'
module.exports = function ( eleventyConfig ) { module.exports = function ( eleventyConfig ) {
// eleventyConfig.addPlugin(eleventyVue) // eleventyConfig.addPlugin(eleventyVue)
// console.log('eleventyConfig', eleventyConfig)
eleventyConfig.addJavaScriptFunction('getNuxt', function () {
return nuxtConfig
})
// eleventyConfig.addGlobalData('nuxt', () => nuxtConfig)
return { return {
dir: { dir: {

View file

@ -1,6 +1,6 @@
import config from '../nuxt.config' import config from '../nuxt.config'
const year = new Date().getFullYear()
const makeTag = ( tag, tagName = 'meta') => { const makeTag = ( tag, tagName = 'meta') => {
@ -72,9 +72,9 @@ class DefaultLayout {
}) { }) {
return /* html */` return /* html */`
<!doctype html> <!doctype html>
<html lang="${ config.head.htmlAttrs.lang }"> <html lang="${ this.getNuxt().head.htmlAttrs.lang }">
<head> <head>
<title>${ title || config.head.title }</title> <title>${ title || this.getNuxt().head.title }</title>
${ this.generateMetaTags() } ${ this.generateMetaTags() }
@ -145,7 +145,7 @@ class DefaultLayout {
</div> </div>
</div> </div>
</div> </div>
<p class="mt-8 text-center text-base leading-6 text-gray-400">© 2020 Does it ARM All rights reserved.</p> <p class="mt-8 text-center text-base leading-6 text-gray-400">© ${ year } ${ this.getNuxt().head.title } All rights reserved.</p>
</div> </div>
</footer> </footer>
</div> </div>