Giter Site home page Giter Site logo

Comments (7)

prototypa avatar prototypa commented on May 20, 2024 1

Hi @abdelkareemkobo

The problem you describe is because the tag name and slug are not saved for the tags, the slug is simply used to show the tags everywhere (including the url).

To create the slug we use a dependency that does those conversions: limax. We have come up with some ideas to solve it but we still do not have a definitive solution to the problem. Maybe if we add a new optional Content Collection so that in cases like yours you can define the name of the tag and slug, we will tell you later what we can think of or if you have any suggestions please let us know.

For now we will give you the two lines that are associated with it:

from astrowind.

prototypa avatar prototypa commented on May 20, 2024 1

Hi @abdelkareemkobo

Sorry for the delay.

Another thing you can do is go to this line:

const tags = rawTags.map((tag: string) => cleanSlug(tag));

and instead of using cleanSlug, create a new function cleanTagSlug that cleans up the slug for the tags a bit, (for example, replaces the spaces with '-' or whatever you need). In simpler case remove the call to the cleanSlug function

from astrowind.

abdelkareemkobo avatar abdelkareemkobo commented on May 20, 2024

image

from astrowind.

abdelkareemkobo avatar abdelkareemkobo commented on May 20, 2024

@prototypa thanks for the fast response, I am waiting for the solution!!

from astrowind.

abdelkareemkobo avatar abdelkareemkobo commented on May 20, 2024

@prototypa can you read this issue where they solve it but i don't know what should i change now in my astrowind theme!
issue
it's a really quick one, thanks in advance

from astrowind.

abdelkareemkobo avatar abdelkareemkobo commented on May 20, 2024

@prototypa Is there any update for this problem! i have built the website and host it but just can't solve this problem! and it prevents me from building the other website with this cool theme!

from astrowind.

abdelkareemkobo avatar abdelkareemkobo commented on May 20, 2024

@prototypa here is my solution

export const cleanSlug = (text = '') => {
  const regex = /[^\d\u0621-\u064A]+/g;

  return trimSlash(text)
    .split('/')
    .map((slug, index, array) => {
      // Preserve slashes in the middle, but replace in the beginning and end
      if (index !== 0 && index !== array.length - 1) {
        return slug;
      }

      // If the slug starts with "-", consider it as a tag and preserve it
      if (slug.startsWith('-')) {
        return slug;
      }

      // Otherwise, replace unwanted characters
      return slug.replace(regex, '-');
    })
    .join('/');
};

I don't know if it the right way to solve it but i works!
the only thing that is wrong is with the
image
is the /-/ should be the word "tag"

from astrowind.

Related Issues (20)

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.