code: def link_source_files(generator):
      
      # Get all attributes from the generator that are articles or pages
      posts = [
          getattr(generator, attr, None) for attr in PROCESS
          if getattr(generator, attr, None) is not None]
      # Work on each item
      for post in posts[0]:
          if not 'SHOW_SOURCE_ON_SIDEBAR' in generator.settings and \
              not 'SHOW_SOURCE_IN_SECTION' in generator.settings:
              return
          # Only try this when specified in metadata or SHOW_SOURCE_ALL_POSTS
          # override is present in settings
          if 'SHOW_SOURCE_ALL_POSTS' in generator.settings or \
              'show_source' in post.metadata:
              # Source file name can be optionally set in config
              show_source_filename = generator.settings.get(
                  'SHOW_SOURCE_FILENAME', '{}.txt'.format(post.slug)
                  )
              try:
                  # Get the full path to the original source file
                  source_out = os.path.join(
                      post.settings['OUTPUT_PATH'], post.save_as
                      )
                  # Get the path to the original source file
                  source_out_path = os.path.split(source_out)[0]
                  # Create 'copy to' destination for writing later
                  copy_to = os.path.join(
                      source_out_path, show_source_filename
                      )
                  # Add file to published path
                  source_url = urljoin(
                      post.save_as, show_source_filename
                      )
              except Exception:
                  return
              # Format post source dict & populate
              out = dict()
              out['copy_raw_from'] = post.source_path
              out['copy_raw_to'] = copy_to
              logger.debug('Linked %s to %s', post.source_path, copy_to)
              source_files.append(out)
              # Also add the source path to the post as an attribute for tpls
              post.show_source_url = source_url
docs: Processes each article/page object and formulates copy from and copy
      to destinations, as well as adding a source file URL as an attribute.