Jekyll Internal Post Links










0















This is a pretty niche problem, but... I run a blog that runs on Jekyll and I post very regularly. To keep my editing sane I regularly archive posts, and those archived posts get a pretty strict structure. But, I go a full year before archiving.



Where this hurts is in links to other posts. I used to be able to absolutely reference the file name (per jekyll markdown internal links), but this appears to be being deprecated:



Deprecation: A call to '% post_url 2018-09-06-peppermint %' did not match a post using the new matching method of checking name (path-date-slug) equality. Please make sure that you change this tag to match the post's name exactly.


Now, if I have to include the full path to the file, then when I archive my posts for the year I have to parse all of the posts for the entire year and update any links between them to include the new file path for their archived location, defeating the point of using this tool at all. A direct link to the page would actually be better, given that I change my URL structure less often.



Is there a better solution for internal links that doesn't depend on the file structure, allowing a file to be moved without having to update every link to that file?



Example File structure:



 _posts
-2018
-post1
-post2
-etc
-Archive
-2017
-2016


If there's no better answer, I may just have to go back to using absolute external links.










share|improve this question






















  • it looks like you are right - I don't use post_url but it was my understanding that it worked as you have been using it. Now it looks like it wants the correct path no matter what (I don't think it is deprecated, just new behavior - wants full path?). There is also link which does much the same thing, but it looks like it wants the path too.

    – Ron
    Nov 17 '18 at 7:02











  • Needing the path is actually more likely to change for me though, as I adjust my archiving. The path is likely to change, but the link structure is not. If the path is required... it's actually easier for me to do absolute URLs given that those are weirdly less likely to change..

    – David Scott IV
    Nov 18 '18 at 9:01















0















This is a pretty niche problem, but... I run a blog that runs on Jekyll and I post very regularly. To keep my editing sane I regularly archive posts, and those archived posts get a pretty strict structure. But, I go a full year before archiving.



Where this hurts is in links to other posts. I used to be able to absolutely reference the file name (per jekyll markdown internal links), but this appears to be being deprecated:



Deprecation: A call to '% post_url 2018-09-06-peppermint %' did not match a post using the new matching method of checking name (path-date-slug) equality. Please make sure that you change this tag to match the post's name exactly.


Now, if I have to include the full path to the file, then when I archive my posts for the year I have to parse all of the posts for the entire year and update any links between them to include the new file path for their archived location, defeating the point of using this tool at all. A direct link to the page would actually be better, given that I change my URL structure less often.



Is there a better solution for internal links that doesn't depend on the file structure, allowing a file to be moved without having to update every link to that file?



Example File structure:



 _posts
-2018
-post1
-post2
-etc
-Archive
-2017
-2016


If there's no better answer, I may just have to go back to using absolute external links.










share|improve this question






















  • it looks like you are right - I don't use post_url but it was my understanding that it worked as you have been using it. Now it looks like it wants the correct path no matter what (I don't think it is deprecated, just new behavior - wants full path?). There is also link which does much the same thing, but it looks like it wants the path too.

    – Ron
    Nov 17 '18 at 7:02











  • Needing the path is actually more likely to change for me though, as I adjust my archiving. The path is likely to change, but the link structure is not. If the path is required... it's actually easier for me to do absolute URLs given that those are weirdly less likely to change..

    – David Scott IV
    Nov 18 '18 at 9:01













0












0








0








This is a pretty niche problem, but... I run a blog that runs on Jekyll and I post very regularly. To keep my editing sane I regularly archive posts, and those archived posts get a pretty strict structure. But, I go a full year before archiving.



Where this hurts is in links to other posts. I used to be able to absolutely reference the file name (per jekyll markdown internal links), but this appears to be being deprecated:



Deprecation: A call to '% post_url 2018-09-06-peppermint %' did not match a post using the new matching method of checking name (path-date-slug) equality. Please make sure that you change this tag to match the post's name exactly.


Now, if I have to include the full path to the file, then when I archive my posts for the year I have to parse all of the posts for the entire year and update any links between them to include the new file path for their archived location, defeating the point of using this tool at all. A direct link to the page would actually be better, given that I change my URL structure less often.



Is there a better solution for internal links that doesn't depend on the file structure, allowing a file to be moved without having to update every link to that file?



Example File structure:



 _posts
-2018
-post1
-post2
-etc
-Archive
-2017
-2016


If there's no better answer, I may just have to go back to using absolute external links.










share|improve this question














This is a pretty niche problem, but... I run a blog that runs on Jekyll and I post very regularly. To keep my editing sane I regularly archive posts, and those archived posts get a pretty strict structure. But, I go a full year before archiving.



Where this hurts is in links to other posts. I used to be able to absolutely reference the file name (per jekyll markdown internal links), but this appears to be being deprecated:



Deprecation: A call to '% post_url 2018-09-06-peppermint %' did not match a post using the new matching method of checking name (path-date-slug) equality. Please make sure that you change this tag to match the post's name exactly.


Now, if I have to include the full path to the file, then when I archive my posts for the year I have to parse all of the posts for the entire year and update any links between them to include the new file path for their archived location, defeating the point of using this tool at all. A direct link to the page would actually be better, given that I change my URL structure less often.



Is there a better solution for internal links that doesn't depend on the file structure, allowing a file to be moved without having to update every link to that file?



Example File structure:



 _posts
-2018
-post1
-post2
-etc
-Archive
-2017
-2016


If there's no better answer, I may just have to go back to using absolute external links.







jekyll






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 16:13









David Scott IVDavid Scott IV

150212




150212












  • it looks like you are right - I don't use post_url but it was my understanding that it worked as you have been using it. Now it looks like it wants the correct path no matter what (I don't think it is deprecated, just new behavior - wants full path?). There is also link which does much the same thing, but it looks like it wants the path too.

    – Ron
    Nov 17 '18 at 7:02











  • Needing the path is actually more likely to change for me though, as I adjust my archiving. The path is likely to change, but the link structure is not. If the path is required... it's actually easier for me to do absolute URLs given that those are weirdly less likely to change..

    – David Scott IV
    Nov 18 '18 at 9:01

















  • it looks like you are right - I don't use post_url but it was my understanding that it worked as you have been using it. Now it looks like it wants the correct path no matter what (I don't think it is deprecated, just new behavior - wants full path?). There is also link which does much the same thing, but it looks like it wants the path too.

    – Ron
    Nov 17 '18 at 7:02











  • Needing the path is actually more likely to change for me though, as I adjust my archiving. The path is likely to change, but the link structure is not. If the path is required... it's actually easier for me to do absolute URLs given that those are weirdly less likely to change..

    – David Scott IV
    Nov 18 '18 at 9:01
















it looks like you are right - I don't use post_url but it was my understanding that it worked as you have been using it. Now it looks like it wants the correct path no matter what (I don't think it is deprecated, just new behavior - wants full path?). There is also link which does much the same thing, but it looks like it wants the path too.

– Ron
Nov 17 '18 at 7:02





it looks like you are right - I don't use post_url but it was my understanding that it worked as you have been using it. Now it looks like it wants the correct path no matter what (I don't think it is deprecated, just new behavior - wants full path?). There is also link which does much the same thing, but it looks like it wants the path too.

– Ron
Nov 17 '18 at 7:02













Needing the path is actually more likely to change for me though, as I adjust my archiving. The path is likely to change, but the link structure is not. If the path is required... it's actually easier for me to do absolute URLs given that those are weirdly less likely to change..

– David Scott IV
Nov 18 '18 at 9:01





Needing the path is actually more likely to change for me though, as I adjust my archiving. The path is likely to change, but the link structure is not. If the path is required... it's actually easier for me to do absolute URLs given that those are weirdly less likely to change..

– David Scott IV
Nov 18 '18 at 9:01












1 Answer
1






active

oldest

votes


















1














Solution 1. Use your own include



Create an post_url.html file and write this:



% include post_url.html slug="2018-09-06-peppermint" %


The include (called post_url.html) should find the post with the right slug and echo the link, like this:



 where:'slug',include.slug %
<a href=" link[0].url "> link[0].title </a>



Solution 2. Search and replace



You have to parse posts? A simple search and replace on all files, looking for (/2018/ and replace with (/Archive/2018/ should do the trick (if you use markdown links). This should take just a few seconds.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323570%2fjekyll-internal-post-links%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Solution 1. Use your own include



    Create an post_url.html file and write this:



    % include post_url.html slug="2018-09-06-peppermint" %


    The include (called post_url.html) should find the post with the right slug and echo the link, like this:



     where:'slug',include.slug %
    <a href=" link[0].url "> link[0].title </a>



    Solution 2. Search and replace



    You have to parse posts? A simple search and replace on all files, looking for (/2018/ and replace with (/Archive/2018/ should do the trick (if you use markdown links). This should take just a few seconds.






    share|improve this answer



























      1














      Solution 1. Use your own include



      Create an post_url.html file and write this:



      % include post_url.html slug="2018-09-06-peppermint" %


      The include (called post_url.html) should find the post with the right slug and echo the link, like this:



       where:'slug',include.slug %
      <a href=" link[0].url "> link[0].title </a>



      Solution 2. Search and replace



      You have to parse posts? A simple search and replace on all files, looking for (/2018/ and replace with (/Archive/2018/ should do the trick (if you use markdown links). This should take just a few seconds.






      share|improve this answer

























        1












        1








        1







        Solution 1. Use your own include



        Create an post_url.html file and write this:



        % include post_url.html slug="2018-09-06-peppermint" %


        The include (called post_url.html) should find the post with the right slug and echo the link, like this:



         where:'slug',include.slug %
        <a href=" link[0].url "> link[0].title </a>



        Solution 2. Search and replace



        You have to parse posts? A simple search and replace on all files, looking for (/2018/ and replace with (/Archive/2018/ should do the trick (if you use markdown links). This should take just a few seconds.






        share|improve this answer













        Solution 1. Use your own include



        Create an post_url.html file and write this:



        % include post_url.html slug="2018-09-06-peppermint" %


        The include (called post_url.html) should find the post with the right slug and echo the link, like this:



         where:'slug',include.slug %
        <a href=" link[0].url "> link[0].title </a>



        Solution 2. Search and replace



        You have to parse posts? A simple search and replace on all files, looking for (/2018/ and replace with (/Archive/2018/ should do the trick (if you use markdown links). This should take just a few seconds.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 8:21









        JoostSJoostS

        6,21121739




        6,21121739





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323570%2fjekyll-internal-post-links%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3

            Museum of Modern and Contemporary Art of Trento and Rovereto