11ty / eleventy-plugin-vue

Use Vue.js templates and Vue.js single file components in Eleventy.
196 stars 11 forks source link

Permalinks should not be compile with Vue #18

Closed igk1972 closed 2 years ago

igk1972 commented 3 years ago

If specify a permalink (as a string or as a function), the Vue template engine should not compile.

Example:

<template>
  <div>
    <div class="container">
        >h1>{{ title }}</h1>
        <div v-html="current.templateContent"></div>
    </div>
  </div>
</template>

<script>
export default {
  data: () => {
    return {
      layout: 'base.njk',
      pagination: {
        data: 'collections.pages',
        size: 1,
        alias: 'current',
        addAllPagesToCollections: true,
      },
      permalink: (page) => `${page.current.data.lang}/${page.current.data.slug}/`,
      eleventyComputed: {
        locale: (page) => page.current.data.lang,
        title: (page) => page.current.data.title,
        description: (page) => page.current.data.description,
      },
    }
  },
  components: {
  },
}
</script>

<style>
</style>
zachleat commented 3 years ago

Ah, why? permalink in every other template language in Eleventy does compile in the template language.

igk1972 commented 3 years ago

Ah, why? permalink in every other template language in Eleventy does compile in the template language.

This PR relate to https://github.com/11ty/eleventy-plugin-vue/blob/f47e76b567cf5f8994820c94964a581e5a06e7ca/.eleventy.js#L126 and PR https://github.com/11ty/eleventy-plugin-vue/pull/9

But with an extra check on '' (empty strinng).

zachleat commented 2 years ago

Sorry for the late response but this was included with #9!