SOLUTION: literally write out [exclamation mark]community@instance. Do not use the autocomplete function. This works in both the sidebar and comments.

Using the URL markdown method (to have the display text be different from the dynamic link) impacts other UIs.

If you enter this:

You get this:

The links in the screenshot above will work in a graceful manner irrespective of what instance (or even what UI/platform?) you use.


Original Text

What are the best practises for adding links to other communities in your sidebar?

I mod the LW hardware community and all the links are tied to LW.

So https://programming.dev/c/linuxhardware

is linked via https://lemmy.world/c/[email protected]

But that would mean anyone not on LW would get a logged out view of LW accessing the programming.dev/linuxhardware community. I don’t have a programming.dev account so I added an LW-specific URL.

Is there some sort of markdown code that would “auto redirect” the user to a view based on their instance without any use of explicit URLs. For a second I thought that’s what the exclamation mark does, but turns out it’s just a shortcut for adding community URLs.

  • Die4Ever
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    3 days ago

    Yeah, use [email protected]

    Don’t use the tab-completion/auto-complete on it cause that screws it up

    Unless the sidebar handles it differently than posts/comments do?

    • Alphane Moon@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      3 days ago

      OK, yeah it does seem to work, at least in comments.

      It even works with the markdown URL syntax (to have the display text be different from the exclamation mark style link/text).

      Let me see if this works in the sidebar.

      EDIT: it does work in the sidebar. The autocomplete really fucks things up though.

      • MentalEdge@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        4
        ·
        3 days ago

        The autocomplete is from before the webUI was updated to turn plaintext mentions of communities clickable.

        For some reason, it wasn’t removed when that was added.

        But just writing the name is standard, and what basically all clients support now.

      • Admiral Patrick@dubvee.org
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        3 days ago

        Ideally, just use the !community@instance syntax.

        In Lemmy-UI, it’ll automatically create a relative link to /c/community@instance. Other UIs also do (and some more than that).

        If you make relative links manually, it messes with other UI’s like Photon and Tesseract that do additional rewriting to render them locally.

        • Alphane Moon@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          3 days ago

          So using the URL markdown syntax with the [exclamationmark]community@instance in the round brackets would mess with other UIs?

          • Admiral Patrick@dubvee.org
            link
            fedilink
            English
            arrow-up
            3
            ·
            edit-2
            3 days ago

            Yes. If not mess with the way they’re handled, then may or may not work as intended/universally.

            The “standard” agreed-upon formats for communities and users is !community@instance and @user@instance (respectively)

            Most UIs handle those consistently to varying degrees. e.g. I went to a lot of effort to make these work, lol

            https://dev.dubvee.org/post/dubvee.org/2207293

            (Click on the community links in the post body)

            • Alphane Moon@lemmy.worldOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              3 days ago

              It seems the example provided by demigodrick results in a community stat page in your UI. This is an example of an error that you mentioned, right?

              I guess I could use a [Text] - [exclamation mark link] style format.

              • Admiral Patrick@dubvee.org
                link
                fedilink
                English
                arrow-up
                1
                ·
                3 days ago

                You mean this?

                That’s intentional. You’re not logged in, but if you were, you’d see options to subscribe/unsubscribe, create a post, etc.

                I went through various community sidebars / posts / etc and tried to cover all the weird ways people were making links to other communities and handle each style; that was…a pain.

                Since LemmyUI started supporting the !community@instance format, I’ve always recommended that method since it’s easier and the closest thing there is to a standard. Would love to drop all the extra regexes for the other formats lol

                • Alphane Moon@lemmy.worldOP
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  edit-2
                  3 days ago

                  This what I get via your UI:

                  In the default UI, it works correctly, sending me to the community via the specific instance I am accessing the content from (tried this with an alt not on LW).

                  This is so fucking difficult and I am technically minded and highly motivated to move away from US oligarch platforms! 😅