Skip to content

Commit

Permalink
Merge branch 'release/1.1.5' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Welch committed Jun 3, 2021
2 parents b1338cb + 2edf584 commit 14d7f47
Show file tree
Hide file tree
Showing 16 changed files with 2,660 additions and 10,191 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Similar Changelog

## 1.1.5 - 2021.06.03
### Changed
* If `orderBy` criteria is omitted, entries are now sorted by the number of relations in common. (https://github.com/nystudio107/craft-similar/issues/35)
* Switch to VitePress for documentation
* Updated `Makefile` to use `node-14-alpine`

## 1.1.4 - 2021.03.27
### Changed
* Move settings from the `composer.json` “extra” to the plugin main class
Expand Down
22 changes: 0 additions & 22 deletions Makefile

This file was deleted.

36 changes: 0 additions & 36 deletions buildchain/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-similar",
"description": "Similar for Craft lets you find elements, Entries, Categories, Commerce Products, etc, that are similar, based on... other related elements.",
"type": "craft-plugin",
"version": "1.1.4",
"version": "1.1.5",
"keywords": [
"craft",
"cms",
Expand Down
8 changes: 8 additions & 0 deletions docs/.textlint.terms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
"Stylus",
"VuePress",
[
"front[- ]matter",
"frontmatter"
]
]
23 changes: 23 additions & 0 deletions docs/.textlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
rules: {
'@textlint-rule/no-unmatched-pair': true,
apostrophe: true,
'common-misspellings': true,
diacritics: true,
'en-capitalization': {
allowHeading: false
},
'stop-words': {
severity: 'warning'
},
terminology: {
terms: `${__dirname}/.textlint.terms.json`
},
'write-good': {
severity: 'warning'
}
},
filters: {
comments: true
}
}
4 changes: 2 additions & 2 deletions Dockerfile → docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TAG=12-alpine
ARG TAG=14-alpine
FROM nystudio107/node-dev-base:$TAG

WORKDIR /app/buildchain/
WORKDIR /app/

CMD ["run build"]

Expand Down
45 changes: 45 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
TAG?=14-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-docs
DOCKERRUN=docker container run \
--name ${CONTAINER} \
--rm \
-p 3002:3002 \
-t \
-v `pwd`:/app \
${CONTAINER}:${TAG}
DOCSDEST?=../../../sites/nystudio107/web/docs/similar

.PHONY: docker build dev fix install lint update npm

docker:
docker build \
. \
-t ${CONTAINER}:${TAG} \
--build-arg TAG=${TAG} \
--no-cache
build: docker install update
${DOCKERRUN} \
run docs:build
rm -rf ${DOCSDEST}
mv ./docs/.vitepress/dist ${DOCSDEST}
dev: docker install
${DOCKERRUN} \
run docs:dev
fix: docker install
${DOCKERRUN} \
run docs:fix
install: docker
${DOCKERRUN} \
install
lint: docker install
${DOCKERRUN} \
run docs:lint
update: docker
${DOCKERRUN} \
update
npm: docker
${DOCKERRUN} \
$(filter-out $@,$(MAKECMDGOALS))
%:
@:
# ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line
18 changes: 18 additions & 0 deletions docs/docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
title: 'Similar Documentation',
description: 'Documentation for the Similar plugin',
base: '/docs/similar/',
lang: 'en-US',
themeConfig: {
repo: 'nystudio107/craft-similar',
docsDir: 'docs/docs',
docsBranch: 'v1',
algolia: {
apiKey: '',
indexName: 'similar'
},
editLinks: true,
editLinkText: 'Edit this page on GitHub',
lastUpdated: 'Last Updated',
},
};
11 changes: 0 additions & 11 deletions docs/docs/.vuepress/config.js

This file was deleted.

6 changes: 3 additions & 3 deletions docs/docs/README.md → docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Similar plugin for Craft CMS 3.x

Similar for Craft lets you find elements, Entries, Categories, Commerce Products, etc, that are similar, based on... other related elements.
Similar for Craft lets you find elements, Entries, Categories, Commerce Products, etc, that are similar, based on... Other related elements.

![Screenshot](./resources/img/plugin-logo.png)

Expand Down Expand Up @@ -47,7 +47,7 @@ The plugin has one template method, `find`, which takes a parameters object with
</ul>
```

There is also a third, optional parameter that you probably would want to use most of the time, `criteria`. `criteria` lets you create the base ElementQuery that Similar will extend, giving you the ability to use all of Craft's usual goodies for your queries. If you'd want to limit the number of entries returned (good idea!), you could do it like this:
There is also a third, optional parameter that you probably would want to use most of the time, `criteria`. `criteria` lets you create the base ElementQuery that Similar will extend, giving you the ability to use all of Crafts usual goodies for your queries. If youd want to limit the number of entries returned (good idea!), you could do it like this:

```twig
{% set limitCriteria = craft.entries.limit(4) %}
Expand All @@ -62,7 +62,7 @@ There is also a third, optional parameter that you probably would want to use mo

The supported element types are `Entry`, `Asset`, `Category`, `Tag`, `User` and `Commerce_Product`. If you miss one, send me a feature request.

The `context` parameter takes either an `ElementQuery`, or a list of ids. If you want to find similar entries based on an entry's tags and categories, you could do:
The `context` parameter takes either an `ElementQuery`, or a list of IDs. To find similar entries based on an entrys tags and categories, you could do:

```twig
{% set ids = entry.tags.ids() | merge(entry.categories.ids()) %}
Expand Down
10 changes: 10 additions & 0 deletions docs/docs/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
server: {
host: '0.0.0.0',
port: 3002,
strictPort: true,
}
});
Loading

0 comments on commit 14d7f47

Please sign in to comment.