Skip to content

Commit

Permalink
changes required with the new template handling in 3.3.5 (getkirby/ki…
Browse files Browse the repository at this point in the history
  • Loading branch information
jmheretik committed Mar 21, 2020
1 parent 0f7d6d9 commit 21cc1a4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ yarn-error.log*

# built files
www/assets
www/site/templates/default.php
www/site/snippets/vue-index.php
www/favicon.ico
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Firstly, adjust the `publicPath` in [kirby.config.js](kirby.config.js) file (mor
npm run build
```

This builds the frontend in the `www/assets` assets directory and the index file as the default kirby template at `www/site/templates/default.php`, which is the only template needed.
This builds the frontend assets in `www/assets` directory and the index file as a kirby snippet in `www/site/snippets/vue-index.php`.

### Deploying

Expand Down
2 changes: 1 addition & 1 deletion kirby.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
port: 80,
baseDir: 'www',
assetsDir: 'assets',
indexPath: 'site/templates/default.php',
indexPath: 'site/snippets/vue-index.php',
routerPath: 'kirby/router.php',
publicPath: '/',

Expand Down
4 changes: 2 additions & 2 deletions src/api/kirby.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export default {
},

async getFile(path) {
return await this.get(`${path.substr(1)}?select=content`)
return await this.get(`${path}?select=content`)
},

async getFileThumb(path, method, ...params) {
params = params.map(field => field).join(',')
return await this.get(`${path.substr(1)}/thumb?method=${method}&params=${params}`)
return await this.get(`${path}/thumb?method=${method}&params=${params}`)
}
}
4 changes: 2 additions & 2 deletions src/components/KirbyImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default {
if (this.file.content) {
image.alt = this.file.content.alt
} else {
const content = await this.$api.getFile(this.file.link)
const content = await this.$api.getFile(this.file.link.substr(1))
image.alt = content.alt
}
if (!this.thumb) {
image.src = this.file.url
} else {
image.src = await this.$api.getFileThumb(this.file.link, this.thumb, this.params)
image.src = await this.$api.getFileThumb(this.file.link.substr(1), this.thumb, this.params)
}
this.image = image
Expand Down
2 changes: 1 addition & 1 deletion www/site/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

if ($page = page($pageId)) {
foreach ($fields as $field) {
$result['data'][$field] = $page->$field()->kirbytext()->value();
$result['data'][$field] = $page->$field()->kt()->value();
}
return $result;
}
Expand Down
1 change: 1 addition & 0 deletions www/site/templates/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php snippet('vue-index') ?>

0 comments on commit 21cc1a4

Please sign in to comment.