Coder Social home page Coder Social logo

dimitrov-adrian / directus-extension-wpslug-interface Goto Github PK

View Code? Open in Web Editor NEW
94.0 2.0 16.0 617 KB

WordPress alike slug interface for Directus 9

Home Page: https://www.npmjs.com/package/directus-extension-wpslug-interface

License: GNU General Public License v3.0

TypeScript 25.83% Vue 74.17%
directus directus-extension directus-custom-interface permalink slug

directus-extension-wpslug-interface's Introduction

WP Slug Interface

WordPress alike slug/permalink interface

Installation

In your Directus installation root

npm install directus-extension-wpslug-interface

Restart directus

How to use

  1. Create new standard field with String type
  2. For interface select Slug

FAQ

What does the update "Create" and "Update" options do?

Simply these options enables/disables the automatic update based on content change.

  • Having "On Create" will enable automattic updating when creating new item.
  • Having "On Update" will enable automattic updating when editing existing item.

It's possible to have both, one or none, depending of your needs.

There is magic wand appearing

The magic stick button appears when the automatic updates are disabled, but there is content change so the field is differing from the template. When clicked, the automatic update will be executed.

Does this works when performing changes throught the API?

No, this is just an interface. It works only on Directus App

directus-extension-wpslug-interface's People

Contributors

dimitrov-adrian avatar tschortsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

directus-extension-wpslug-interface's Issues

Getting nested data as prefix doesn't work

Hello, and firstly, thanks for your interface !

I have been using it for as simple page slug for now, and it is extremely helpful.
But I am now trying to setup a more complex data model, where each page can have a parent page.
I got this part working using relational fields.

I'm now trying to set the child slug prefixed with the parent slug if it is present.
I have set a condition to the fields, for when it has a parent page linked, the prefix should be {{parent.slug}}/.

The result of this is a slug missing the variable, like so /page-slug, instead of parent-slug/page-slug.

However, setting the prefix to simply {{parent}}/ does correctly output the parent ID.
In my case it is an UUID, and therefore the page slug results in parent-uuid/page-slug.

It is supposed to work like so ?
I feel it should as nested data is listed in the prefix field

Hope my request is clear ;) thanks in advance !

Modified slug gets updated once again when record form is reopened

Hey @dimitrov-adrian

Thanks for creating this extension, it looks to be very handy!

I am testing it out on an instance and I noticed a behaviour which I think is a bug, or at least could be improved, here are the steps to reproduce:

  1. Add slug field & interface to collection, set template as another field.
  2. Create / edit a record with a custom url, when editing for the first time the interface behaves correctly, after editing, the slug is no longer auto-generated.
  3. Save the record with edited slug
  4. Reopen the record for editing.
  5. Slug displays the wand button (auto-generate), so haveChange is true.
  6. Any changes to the field set as template immediately triggers updating the url, so the previous changes are lost.

I think that changes should be persistent when the form is reopened for editing.

I thought it may be a simple fix in setup() to instantiate isTouched based on haveChange but that turned out to only work when the form is loaded for the first time (e.g. a full page refresh). When following a link from inside the admin app, props.value is null in setup() and gets populated later on.

I have a working version, but I haven't created a pull request as there is likely a better way to accomplish this:
benosman@1948e03

Note: my fork is modified to work on a slightly outdated version of directus, but the actual vue component was the same as your v1.0.0

Slug is not saved to DB

Hi There,

First of all, thank you for this extension. It will save lot of time for slug-related setup to blogging/content related projects.

Now, I have setup Directus 9.8.0 and installed this extension. Issue is, I did configure it correctly but data are not saved to database. Also it does not manages slugs. Example
BlogTitle1 = blog/blogtitle1
BlogTitle2= blog/blogtitle2
BlogTitle1 = blog/blogtitle1 <- this is issue. it should change to blog/blogtitle1-1 or something else.

Can you fix and update this package?

Show slug with prefix in graphql

Hi @dimitrov-adrian

First of all. Thanks for this extension. It helps a lot.

I have a question, but I don't know if it is a issue.

I'm working with graphql to make the queries in my collections.

And I have a collection named Projects. An this collection have a slug field, with a prefix defined (project-). i've put this prefix in the Interface and the Display sections.

But when I get the slug field through the graphql query, the slug cames without the prefix.

Is it the normal behavior or is it an issue?

Thanks again for your time.

Slug name constantly resets in Directus 9.8.0

Hi, first of all I must say the extension has been really handy for helping architect some blog projects I am working on!

However, since updating our Docker image to 9.8.0, we've noticed this bug appear where attempting to insert a title constantly updates and rewrites the slug, which seems to then empty the Title.

ezgif-1-7bbec7e4e8

Directus v10

Hi,

Could you update requirements for Directus v10?

Thanks!

slug gets updated on saving in current directus version

Hi,

I'm currently using Directus 10.6.1 and I've noticed a serious issue with the extension. I configured the slug field to only update upon creation. However, when saving the form using keyboard hotkeys (COMMAND/CTRL+S) or the save-option within the three-dots menu instead of the save icon, the slug also gets updated!

Best regards,

Kamil

update to slugify v2.2.0

Hello, thank you so much for this extension, it save me a lot of time!
I see that in slugify v2.2.0 there is the new option preserveCharacters ; it will be useful to build links with subpages as it will be possibile to add others characters like "/".
Are you planning to update it?

thank you

Page hangs when the input is empty

You start typing in the textbox in the parent input from which you want to generate slug it works fine but as soon you erase the last word or try to make the parent input empty it hangs the whole application

slug is not unique when template fields are equal

If there are two items in a collection with the same values which are used in the template input the resulting slug is also the same.
But a slug should be unique.
The WP function (docs here: https://developer.wordpress.org/reference/functions/wp_unique_term_slug/)

  1. create the slug according the template
  2. check the DB if / how many items exist
  3. if items exist: add "-" + number to the slug --> myslug-1
  4. repeat check with new slug. increase number if necessary and repeat again...

Maybe you can check if the slug field has been set to unique in Directus and only apply the "makeUnique" function then. So is is more flexible if so users for some reason need multiple items with the same slug. But I think that would be pretty cool.

Form didn't respond when modify (RESULT_CODE_HUNG)

Hi,

The magic wand button does not appear when creating a new item, but it appears after creation when updating. However, clicking the magic wand makes the page freeze (RESULT_CODE_HUNG).
Directus v.9.24.0

Thanks.

Insert data with api

Hi!

When i use the API, insert or update fields, the slug is not executed.
Can anybody help me about that problem?

Thanks! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.