How do I link a page in a template? [closed]












1















If there is a basic page with the route '/about', how can I link it in a template file?



<a href="{{ What goes here? }}"></a>









share|improve this question















closed as unclear what you're asking by leymannx, Shawn Conn, DRUPWAY, mradcliffe, iStryker Jan 7 at 19:04


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • <a href="/about"></a>

    – leymannx
    Dec 27 '18 at 6:15
















1















If there is a basic page with the route '/about', how can I link it in a template file?



<a href="{{ What goes here? }}"></a>









share|improve this question















closed as unclear what you're asking by leymannx, Shawn Conn, DRUPWAY, mradcliffe, iStryker Jan 7 at 19:04


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • <a href="/about"></a>

    – leymannx
    Dec 27 '18 at 6:15














1












1








1








If there is a basic page with the route '/about', how can I link it in a template file?



<a href="{{ What goes here? }}"></a>









share|improve this question
















If there is a basic page with the route '/about', how can I link it in a template file?



<a href="{{ What goes here? }}"></a>






theming






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 27 '18 at 7:49









kiamlaluno

80.6k9132249




80.6k9132249










asked Dec 26 '18 at 22:41









craydencrayden

1247




1247




closed as unclear what you're asking by leymannx, Shawn Conn, DRUPWAY, mradcliffe, iStryker Jan 7 at 19:04


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by leymannx, Shawn Conn, DRUPWAY, mradcliffe, iStryker Jan 7 at 19:04


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • <a href="/about"></a>

    – leymannx
    Dec 27 '18 at 6:15



















  • <a href="/about"></a>

    – leymannx
    Dec 27 '18 at 6:15

















<a href="/about"></a>

– leymannx
Dec 27 '18 at 6:15





<a href="/about"></a>

– leymannx
Dec 27 '18 at 6:15










2 Answers
2






active

oldest

votes


















3














Let assume the page is a node whose ID is 4. You can use the following code, in a template file.



<a href="{{ path('entity.node.canonical', {'node': 4}) }}">About us</a>"





share|improve this answer


























  • Is there no way to specify using a path based on the URL alias? Such as '/about'?

    – crayden
    Dec 26 '18 at 23:10






  • 1





    @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

    – No Sssweat
    Dec 27 '18 at 0:24













  • @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

    – No Sssweat
    Dec 30 '18 at 1:55





















2














You can use the path function to call specific routes



<a href="{{ path('user.register') }}">My link</a>


Or of course, you can do it the old-fashioned way



<a href="/about">My link</a>





share|improve this answer






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Let assume the page is a node whose ID is 4. You can use the following code, in a template file.



    <a href="{{ path('entity.node.canonical', {'node': 4}) }}">About us</a>"





    share|improve this answer


























    • Is there no way to specify using a path based on the URL alias? Such as '/about'?

      – crayden
      Dec 26 '18 at 23:10






    • 1





      @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

      – No Sssweat
      Dec 27 '18 at 0:24













    • @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

      – No Sssweat
      Dec 30 '18 at 1:55


















    3














    Let assume the page is a node whose ID is 4. You can use the following code, in a template file.



    <a href="{{ path('entity.node.canonical', {'node': 4}) }}">About us</a>"





    share|improve this answer


























    • Is there no way to specify using a path based on the URL alias? Such as '/about'?

      – crayden
      Dec 26 '18 at 23:10






    • 1





      @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

      – No Sssweat
      Dec 27 '18 at 0:24













    • @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

      – No Sssweat
      Dec 30 '18 at 1:55
















    3












    3








    3







    Let assume the page is a node whose ID is 4. You can use the following code, in a template file.



    <a href="{{ path('entity.node.canonical', {'node': 4}) }}">About us</a>"





    share|improve this answer















    Let assume the page is a node whose ID is 4. You can use the following code, in a template file.



    <a href="{{ path('entity.node.canonical', {'node': 4}) }}">About us</a>"






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 27 '18 at 7:51









    kiamlaluno

    80.6k9132249




    80.6k9132249










    answered Dec 26 '18 at 23:05









    MiharbKHMiharbKH

    3127




    3127













    • Is there no way to specify using a path based on the URL alias? Such as '/about'?

      – crayden
      Dec 26 '18 at 23:10






    • 1





      @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

      – No Sssweat
      Dec 27 '18 at 0:24













    • @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

      – No Sssweat
      Dec 30 '18 at 1:55





















    • Is there no way to specify using a path based on the URL alias? Such as '/about'?

      – crayden
      Dec 26 '18 at 23:10






    • 1





      @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

      – No Sssweat
      Dec 27 '18 at 0:24













    • @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

      – No Sssweat
      Dec 30 '18 at 1:55



















    Is there no way to specify using a path based on the URL alias? Such as '/about'?

    – crayden
    Dec 26 '18 at 23:10





    Is there no way to specify using a path based on the URL alias? Such as '/about'?

    – crayden
    Dec 26 '18 at 23:10




    1




    1





    @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

    – No Sssweat
    Dec 27 '18 at 0:24







    @crayden What if a month from now someone decides to change it to /about-us? What do you think will happen if the alias changes?

    – No Sssweat
    Dec 27 '18 at 0:24















    @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

    – No Sssweat
    Dec 30 '18 at 1:55







    @crayden in the case above, path() will automatically get the URL, the alias if there is one, based on the node id.

    – No Sssweat
    Dec 30 '18 at 1:55















    2














    You can use the path function to call specific routes



    <a href="{{ path('user.register') }}">My link</a>


    Or of course, you can do it the old-fashioned way



    <a href="/about">My link</a>





    share|improve this answer




























      2














      You can use the path function to call specific routes



      <a href="{{ path('user.register') }}">My link</a>


      Or of course, you can do it the old-fashioned way



      <a href="/about">My link</a>





      share|improve this answer


























        2












        2








        2







        You can use the path function to call specific routes



        <a href="{{ path('user.register') }}">My link</a>


        Or of course, you can do it the old-fashioned way



        <a href="/about">My link</a>





        share|improve this answer













        You can use the path function to call specific routes



        <a href="{{ path('user.register') }}">My link</a>


        Or of course, you can do it the old-fashioned way



        <a href="/about">My link</a>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 26 '18 at 22:56









        100pic100pic

        46328




        46328















            Popular posts from this blog

            To store a contact into the json file from server.js file using a class in NodeJS

            Redirect URL with Chrome Remote Debugging Android Devices

            Dieringhausen